mirror of
https://github.com/golang/go
synced 2024-11-19 18:44:41 -07:00
net: remove unused functions
Remove unused functions, getip() and sockaddrToString(). Remove unnecessary linebreaks. R=golang-dev CC=golang-dev https://golang.org/cl/4523062
This commit is contained in:
parent
34ac4ec30c
commit
4336116d3b
@ -30,7 +30,6 @@ func (e *DNSConfigError) String() string {
|
||||
func (e *DNSConfigError) Timeout() bool { return false }
|
||||
func (e *DNSConfigError) Temporary() bool { return false }
|
||||
|
||||
|
||||
// See resolv.conf(5) on a Linux machine.
|
||||
// TODO(rsc): Supposed to call uname() and chop the beginning
|
||||
// of the host name to get the default search domain.
|
||||
|
@ -117,7 +117,6 @@ type dnsRR interface {
|
||||
Header() *dnsRR_Header
|
||||
}
|
||||
|
||||
|
||||
// Specific DNS RR formats for each query type.
|
||||
|
||||
type dnsRR_CNAME struct {
|
||||
|
@ -119,25 +119,6 @@ Error:
|
||||
return nil, &OpError{mode, net, addr, oserr}
|
||||
}
|
||||
|
||||
func getip(fd int, remote bool) (ip []byte, port int, ok bool) {
|
||||
// No attempt at error reporting because
|
||||
// there are no possible errors, and the
|
||||
// caller won't report them anyway.
|
||||
var sa syscall.Sockaddr
|
||||
if remote {
|
||||
sa, _ = syscall.Getpeername(fd)
|
||||
} else {
|
||||
sa, _ = syscall.Getsockname(fd)
|
||||
}
|
||||
switch sa := sa.(type) {
|
||||
case *syscall.SockaddrInet4:
|
||||
return sa.Addr[0:], sa.Port, true
|
||||
case *syscall.SockaddrInet6:
|
||||
return sa.Addr[0:], sa.Port, true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type InvalidAddrError string
|
||||
|
||||
func (e InvalidAddrError) String() string { return string(e) }
|
||||
|
@ -153,16 +153,3 @@ type UnknownSocketError struct {
|
||||
func (e *UnknownSocketError) String() string {
|
||||
return "unknown socket address type " + reflect.TypeOf(e.sa).String()
|
||||
}
|
||||
|
||||
func sockaddrToString(sa syscall.Sockaddr) (name string, err os.Error) {
|
||||
switch a := sa.(type) {
|
||||
case *syscall.SockaddrInet4:
|
||||
return JoinHostPort(IP(a.Addr[0:]).String(), itoa(a.Port)), nil
|
||||
case *syscall.SockaddrInet6:
|
||||
return JoinHostPort(IP(a.Addr[0:]).String(), itoa(a.Port)), nil
|
||||
case *syscall.SockaddrUnix:
|
||||
return a.Name, nil
|
||||
}
|
||||
|
||||
return "", &UnknownSocketError{sa}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user