Commit 4336116d authored by Mikio Hara's avatar Mikio Hara Committed by Brad Fitzpatrick

net: remove unused functions

Remove unused functions, getip() and sockaddrToString().
Remove unnecessary linebreaks.

R=golang-dev
CC=golang-dev
https://golang.org/cl/4523062
parent 34ac4ec3
...@@ -30,7 +30,6 @@ func (e *DNSConfigError) String() string { ...@@ -30,7 +30,6 @@ func (e *DNSConfigError) String() string {
func (e *DNSConfigError) Timeout() bool { return false } func (e *DNSConfigError) Timeout() bool { return false }
func (e *DNSConfigError) Temporary() bool { return false } func (e *DNSConfigError) Temporary() bool { return false }
// See resolv.conf(5) on a Linux machine. // See resolv.conf(5) on a Linux machine.
// TODO(rsc): Supposed to call uname() and chop the beginning // TODO(rsc): Supposed to call uname() and chop the beginning
// of the host name to get the default search domain. // of the host name to get the default search domain.
......
...@@ -117,7 +117,6 @@ type dnsRR interface { ...@@ -117,7 +117,6 @@ type dnsRR interface {
Header() *dnsRR_Header Header() *dnsRR_Header
} }
// Specific DNS RR formats for each query type. // Specific DNS RR formats for each query type.
type dnsRR_CNAME struct { type dnsRR_CNAME struct {
......
...@@ -119,25 +119,6 @@ Error: ...@@ -119,25 +119,6 @@ Error:
return nil, &OpError{mode, net, addr, oserr} 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 type InvalidAddrError string
func (e InvalidAddrError) String() string { return string(e) } func (e InvalidAddrError) String() string { return string(e) }
......
...@@ -153,16 +153,3 @@ type UnknownSocketError struct { ...@@ -153,16 +153,3 @@ type UnknownSocketError struct {
func (e *UnknownSocketError) String() string { func (e *UnknownSocketError) String() string {
return "unknown socket address type " + reflect.TypeOf(e.sa).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}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment