2
0
mirror of https://github.com/stefan01/transocks.git synced 2025-02-21 03:00:48 +07:00
transocks/original_dst_stub.go
Yamamoto, Hirotaka 4fa2892a52 Initial commit
2016-03-08 16:16:36 +09:00

17 lines
507 B
Go

// +build !linux
package transocks
import "net"
// GetOriginalDST retrieves the original destination address from
// NATed connection. Currently, only Linux iptables using DNAT/REDIRECT
// is supported. For other operating systems, this will just return
// conn.LocalAddr().
//
// Note that this function only works when nf_conntrack_ipv4 and/or
// nf_conntrack_ipv6 is loaded in the kernel.
func GetOriginalDST(conn *net.TCPConn) (*net.TCPAddr, error) {
return conn.LocalAddr().(*net.TCPAddr), nil
}