Source File
iprawsock.go
Belonging Package
net
package net
import (
)
func ( *IPAddr) () string { return "ip" }
func ( *IPAddr) () string {
if == nil {
return "<nil>"
}
:= ipEmptyString(.IP)
if .Zone != "" {
return + "%" + .Zone
}
return
}
func ( *IPAddr) () bool {
if == nil || .IP == nil {
return true
}
return .IP.IsUnspecified()
}
func ( *IPAddr) () Addr {
if == nil {
return nil
}
return
}
func (, string) (*IPAddr, error) {
if == "" { // a hint wildcard for Go 1.0 undocumented behavior
= "ip"
}
, , := parseNetwork(context.Background(), , false)
if != nil {
return nil,
}
switch {
case "ip", "ip4", "ip6":
default:
return nil, UnknownNetworkError()
}
, := DefaultResolver.internetAddrList(context.Background(), , )
if != nil {
return nil,
}
return .forResolve(, ).(*IPAddr), nil
}
func ( *IPConn) ( []byte, Addr) (int, error) {
if !.ok() {
return 0, syscall.EINVAL
}
, := .(*IPAddr)
if ! {
return 0, &OpError{Op: "write", Net: .fd.net, Source: .fd.laddr, Addr: , Err: syscall.EINVAL}
}
, := .writeTo(, )
if != nil {
= &OpError{Op: "write", Net: .fd.net, Source: .fd.laddr, Addr: .opAddr(), Err: }
}
return ,
}
func ( string, , *IPAddr) (*IPConn, error) {
if == nil {
return nil, &OpError{Op: "dial", Net: , Source: .opAddr(), Addr: nil, Err: errMissingAddress}
}
:= &sysDialer{network: , address: .String()}
, := .dialIP(context.Background(), , )
if != nil {
return nil, &OpError{Op: "dial", Net: , Source: .opAddr(), Addr: .opAddr(), Err: }
}
return , nil
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |