mirror of
https://github.com/golang/go
synced 2024-11-22 15:34:53 -07:00
net: extend sockaddr interface to the all address families
This CL extends existing sockaddr interface to accommodate not only internet protocol family endpoint addressess but unix network family endpoint addresses. This is in preparation for runtime-integrated network pollster for BSD variants. Update #5199 R=golang-dev, dave CC=golang-dev https://golang.org/cl/11979043
This commit is contained in:
parent
bf61a97f24
commit
e257cd8aae
@ -120,15 +120,6 @@ func favoriteAddrFamily(net string, laddr, raddr sockaddr, mode string) (family
|
||||
|
||||
// Internet sockets (TCP, UDP, IP)
|
||||
|
||||
// A sockaddr represents a TCP, UDP or IP network address that can
|
||||
// be converted into a syscall.Sockaddr.
|
||||
type sockaddr interface {
|
||||
Addr
|
||||
family() int
|
||||
isWildcard() bool
|
||||
sockaddr(family int) (syscall.Sockaddr, error)
|
||||
}
|
||||
|
||||
func internetSocket(net string, laddr, raddr sockaddr, deadline time.Time, sotype, proto int, mode string, toAddr func(syscall.Sockaddr) Addr) (fd *netFD, err error) {
|
||||
var la, ra syscall.Sockaddr
|
||||
family, ipv6only := favoriteAddrFamily(net, laddr, raddr, mode)
|
||||
|
@ -11,6 +11,16 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// A sockaddr represents a TCP, UDP, IP network endpoint address that
|
||||
// can be converted into a syscall.Sockaddr.
|
||||
type sockaddr interface {
|
||||
Addr
|
||||
family() int
|
||||
isWildcard() bool
|
||||
sockaddr(family int) (syscall.Sockaddr, error)
|
||||
toAddr() sockaddr
|
||||
}
|
||||
|
||||
// Generic POSIX socket creation.
|
||||
func socket(net string, f, t, p int, ipv6only bool, ulsa, ursa syscall.Sockaddr, deadline time.Time, toAddr func(syscall.Sockaddr) Addr) (fd *netFD, err error) {
|
||||
s, err := sysSocket(f, t, p)
|
||||
|
Loading…
Reference in New Issue
Block a user