2
0
mirror of https://github.com/stefan01/transocks.git synced 2025-02-22 03:30:45 +07:00
transocks/original_dst_stub.go

17 lines
507 B
Go
Raw Normal View History

2016-03-04 07:54:59 +06:00
// +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
}