diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-10-29 18:24:58 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-10-29 18:24:58 +0900 |
commit | 0b4d946298c6aca479dc79b578adb9ae0da1a850 (patch) | |
tree | 263fde5bfb40708996b18f1c0c2eecd5a77418e4 /pkg/server/sockopt_linux.go | |
parent | 4cd45f42f9b29e4d7a86f8aa271b7b38aefeae87 (diff) |
server: unexport TCPDialer/TCPListener/TCPSockopt stuff
No need to export them. Also fixed golint errors.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'pkg/server/sockopt_linux.go')
-rw-r--r-- | pkg/server/sockopt_linux.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/pkg/server/sockopt_linux.go b/pkg/server/sockopt_linux.go index 152e97de..ac2ecdb2 100644 --- a/pkg/server/sockopt_linux.go +++ b/pkg/server/sockopt_linux.go @@ -25,8 +25,8 @@ import ( ) const ( - TCP_MD5SIG = 14 // TCP MD5 Signature (RFC2385) - IPV6_MINHOPCOUNT = 73 // Generalized TTL Security Mechanism (RFC5082) + tcpMD5SIG = 14 // TCP MD5 Signature (RFC2385) + ipv6MinHopCount = 73 // Generalized TTL Security Mechanism (RFC5082) ) type tcpmd5sig struct { @@ -57,7 +57,7 @@ func buildTcpMD5Sig(address string, key string) (tcpmd5sig, error) { return t, nil } -func SetTcpMD5SigSockopt(l *net.TCPListener, address string, key string) error { +func setTCPMD5SigSockopt(l *net.TCPListener, address string, key string) error { t, err := buildTcpMD5Sig(address, key) if err != nil { return err @@ -68,10 +68,10 @@ func SetTcpMD5SigSockopt(l *net.TCPListener, address string, key string) error { if err != nil { return err } - return setsockOptString(sc, syscall.IPPROTO_TCP, TCP_MD5SIG, string(b[:])) + return setsockOptString(sc, syscall.IPPROTO_TCP, tcpMD5SIG, string(b[:])) } -func SetListenTcpTTLSockopt(l *net.TCPListener, ttl int) error { +func setListenTCPTTLSockopt(l *net.TCPListener, ttl int) error { family := extractFamilyFromTCPListener(l) sc, err := l.SyscallConn() if err != nil { @@ -80,7 +80,7 @@ func SetListenTcpTTLSockopt(l *net.TCPListener, ttl int) error { return setsockoptIpTtl(sc, family, ttl) } -func SetTcpTTLSockopt(conn *net.TCPConn, ttl int) error { +func setTCPTTLSockopt(conn *net.TCPConn, ttl int) error { family := extractFamilyFromTCPConn(conn) sc, err := conn.SyscallConn() if err != nil { @@ -89,7 +89,7 @@ func SetTcpTTLSockopt(conn *net.TCPConn, ttl int) error { return setsockoptIpTtl(sc, family, ttl) } -func SetTcpMinTTLSockopt(conn *net.TCPConn, ttl int) error { +func setTCPMinTTLSockopt(conn *net.TCPConn, ttl int) error { family := extractFamilyFromTCPConn(conn) sc, err := conn.SyscallConn() if err != nil { @@ -99,7 +99,7 @@ func SetTcpMinTTLSockopt(conn *net.TCPConn, ttl int) error { name := syscall.IP_MINTTL if family == syscall.AF_INET6 { level = syscall.IPPROTO_IPV6 - name = IPV6_MINHOPCOUNT + name = ipv6MinHopCount } return setsockOptInt(sc, level, name, ttl) } @@ -110,7 +110,7 @@ func setsockoptTcpMD5Sig(fd int, address string, key string) error { return err } b := *(*[unsafe.Sizeof(t)]byte)(unsafe.Pointer(&t)) - return os.NewSyscallError("setsockopt", syscall.SetsockoptString(fd, syscall.IPPROTO_TCP, TCP_MD5SIG, string(b[:]))) + return os.NewSyscallError("setsockopt", syscall.SetsockoptString(fd, syscall.IPPROTO_TCP, tcpMD5SIG, string(b[:]))) } func setsockoptIpTtl2(fd int, family int, value int) error { @@ -128,25 +128,25 @@ func setsockoptIpMinTtl(fd int, family int, value int) error { name := syscall.IP_MINTTL if family == syscall.AF_INET6 { level = syscall.IPPROTO_IPV6 - name = IPV6_MINHOPCOUNT + name = ipv6MinHopCount } return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, level, name, value)) } -type TCPDialer struct { +type tcpDialer struct { net.Dialer // MD5 authentication password. AuthPassword string // The TTL value to set outgoing connection. - Ttl uint8 + TTL uint8 // The minimum TTL value for incoming packets. - TtlMin uint8 + TTLMin uint8 } -func (d *TCPDialer) DialTCP(addr string, port int) (*net.TCPConn, error) { +func (d *tcpDialer) DialTCP(addr string, port int) (*net.TCPConn, error) { var family int var ra, la syscall.Sockaddr @@ -214,14 +214,14 @@ func (d *TCPDialer) DialTCP(addr string, port int) (*net.TCPConn, error) { } } - if d.Ttl != 0 { - if err = setsockoptIpTtl2(fd, family, int(d.Ttl)); err != nil { + if d.TTL != 0 { + if err = setsockoptIpTtl2(fd, family, int(d.TTL)); err != nil { return nil, err } } - if d.TtlMin != 0 { - if err = setsockoptIpMinTtl(fd, family, int(d.Ttl)); err != nil { + if d.TTLMin != 0 { + if err = setsockoptIpMinTtl(fd, family, int(d.TTL)); err != nil { return nil, err } } |