github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/app/tun/net/net.go (about) 1 package net 2 3 import ( 4 "github.com/v2fly/v2ray-core/v5/common/net" 5 6 "gvisor.dev/gvisor/pkg/tcpip" 7 "gvisor.dev/gvisor/pkg/tcpip/stack" 8 ) 9 10 type TCPConn interface { 11 net.Conn 12 13 ID() *stack.TransportEndpointID 14 } 15 16 type UDPConn interface { 17 net.Conn 18 net.PacketConn 19 20 ID() *stack.TransportEndpointID 21 } 22 23 func AddressFromTCPIPAddr(addr tcpip.Address) net.Address { 24 return net.IPAddress(addr.AsSlice()) 25 }