mirror of
https://github.com/stefan01/transocks.git
synced 2025-02-22 03:30:45 +07:00
17 lines
507 B
Go
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
|
|
}
|