1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-10 06:16:53 -05:00
v2fly/app/tun/net/net.go

26 lines
399 B
Go
Raw Normal View History

2023-05-28 10:22:59 -04:00
package net
import (
"github.com/v2fly/v2ray-core/v5/common/net"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/stack"
)
type TCPConn interface {
net.Conn
ID() *stack.TransportEndpointID
}
type UDPConn interface {
net.Conn
2023-05-28 10:32:01 -04:00
net.PacketConn
2023-05-28 10:22:59 -04:00
ID() *stack.TransportEndpointID
}
func AddressFromTCPIPAddr(addr tcpip.Address) net.Address {
return net.IPAddress(addr.AsSlice())
}