Documentation
¶
Index ¶
- Constants
- Variables
- func DialSystemConn(ctx context.Context, dest net.Destination, sockopt *SocketSetting) (net.Conn, error)
- func ListenSystem(ctx context.Context, addr net.Addr, sockopt *SocketSetting) (net.Listener, error)
- func ListenSystemPacket(ctx context.Context, network, address string, sockopt *SocketSetting) (net.PacketConn, error)
- func RegisterListenerController(controller func(network, address string, fd uintptr) error) error
- type BindToDeviceGet
- type ConstBindToDeviceGet
- type DefaultListener
- type DefaultSystemDialer
- type DialError
- type FileLocker
- type SocketConfig_TCPFastOpenState
- type SocketConfig_TProxyMode
- type SocketSetting
- func (s *SocketSetting) Copy() *SocketSetting
- func (s *SocketSetting) Dial(ctx context.Context, dest net1.Destination) (net.Conn, error)
- func (so *SocketSetting) Dulplicate() *SocketSetting
- func (x *SocketSetting) GetAcceptProxyProtocol() bool
- func (x *SocketSetting) GetBindAddress() []byte
- func (x *SocketSetting) GetBindPort() uint32
- func (x *SocketSetting) GetBindToDevice4() uint32
- func (x *SocketSetting) GetBindToDevice6() uint32
- func (x *SocketSetting) GetForceBufSize() bool
- func (x *SocketSetting) GetLocalAddr4() string
- func (x *SocketSetting) GetLocalAddr6() string
- func (x *SocketSetting) GetMark() uint32
- func (x *SocketSetting) GetReceiveOriginalDestAddress() bool
- func (x *SocketSetting) GetRxBufSize() int64
- func (x *SocketSetting) GetTcpKeepAliveIdle() int32
- func (x *SocketSetting) GetTcpKeepAliveInterval() int32
- func (x *SocketSetting) GetTfo() SocketConfig_TCPFastOpenState
- func (x *SocketSetting) GetTfoQueueLength() uint32
- func (x *SocketSetting) GetTproxy() SocketConfig_TProxyMode
- func (x *SocketSetting) GetTxBufSize() int64
- func (s *SocketSetting) Listen(ctx context.Context, addr net.Addr) (net.Listener, error)
- func (s *SocketSetting) ListenPacket(ctx context.Context, network, address string) (net.PacketConn, error)
- type Sockopt
Constants ¶
View Source
const ( // For incoming connections. TCP_FASTOPEN = 23 // nolint: revive,stylecheck // For out-going connections. TCP_FASTOPEN_CONNECT = 30 // nolint: revive,stylecheck )
Variables ¶
View Source
var ( SocketConfig_TCPFastOpenState_name = map[int32]string{ 0: "AsIs", 1: "Enable", 2: "Disable", } SocketConfig_TCPFastOpenState_value = map[string]int32{ "AsIs": 0, "Enable": 1, "Disable": 2, } )
Enum value maps for SocketConfig_TCPFastOpenState.
View Source
var ( SocketConfig_TProxyMode_name = map[int32]string{ 0: "Off", 1: "TProxy", 2: "Redirect", } SocketConfig_TProxyMode_value = map[string]int32{ "Off": 0, "TProxy": 1, "Redirect": 2, } )
Enum value maps for SocketConfig_TProxyMode.
View Source
var ErrBindToDeviceNotFound = errors.New("bind to device not found")
Functions ¶
func DialSystemConn ¶
func DialSystemConn(ctx context.Context, dest net.Destination, sockopt *SocketSetting) (net.Conn, error)
DialSystemConn calls system dialer to create a network connection.
func ListenSystem ¶
ListenSystem listens on a local address for incoming TCP connections.
func ListenSystemPacket ¶
func ListenSystemPacket(ctx context.Context, network, address string, sockopt *SocketSetting) (net.PacketConn, error)
ListenSystemPacket listens on a local address for incoming UDP connections.
func RegisterListenerController ¶
RegisterListenerController adds a controller to the effective system listener. The controller can be used to operate on file descriptors before they are put into use.
v2ray:api:beta
Types ¶
type BindToDeviceGet ¶
type BindToDeviceGet interface {
GetBindToDevice() uint32
}
type ConstBindToDeviceGet ¶
type ConstBindToDeviceGet struct {
BindToDevice uint32
}
func (*ConstBindToDeviceGet) GetBindToDevice ¶
func (c *ConstBindToDeviceGet) GetBindToDevice() uint32
type DefaultListener ¶
type DefaultListener struct {
// contains filtered or unexported fields
}
func (*DefaultListener) Listen ¶
func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *SocketSetting) (net.Listener, error)
func (*DefaultListener) ListenPacket ¶
func (dl *DefaultListener) ListenPacket(ctx context.Context, network, address string, sockopt *SocketSetting) (net.PacketConn, error)
type DefaultSystemDialer ¶
type DefaultSystemDialer struct {
// contains filtered or unexported fields
}
func (*DefaultSystemDialer) DialConn ¶
func (d *DefaultSystemDialer) DialConn(ctx context.Context, raddr net1.Destination, sockopt *SocketSetting) (net.Conn, error)
src is outbound.gateway
type FileLocker ¶
type FileLocker struct {
// contains filtered or unexported fields
}
FileLocker is UDS access lock
type SocketConfig_TCPFastOpenState ¶
type SocketConfig_TCPFastOpenState int32
const ( // AsIs is to leave the current TFO state as is, unmodified. SocketConfig_AsIs SocketConfig_TCPFastOpenState = 0 // Enable is for enabling TFO explictly. SocketConfig_Enable SocketConfig_TCPFastOpenState = 1 // Disable is for disabling TFO explictly. SocketConfig_Disable SocketConfig_TCPFastOpenState = 2 )
func (SocketConfig_TCPFastOpenState) Enum ¶
func (x SocketConfig_TCPFastOpenState) Enum() *SocketConfig_TCPFastOpenState
type SocketConfig_TProxyMode ¶
type SocketConfig_TProxyMode int32
const ( // TProxy is off. SocketConfig_Off SocketConfig_TProxyMode = 0 // TProxy mode. SocketConfig_TProxy SocketConfig_TProxyMode = 1 // Redirect mode. SocketConfig_Redirect SocketConfig_TProxyMode = 2 )
func (SocketConfig_TProxyMode) Enum ¶
func (x SocketConfig_TProxyMode) Enum() *SocketConfig_TProxyMode
func (SocketConfig_TProxyMode) IsEnabled ¶
func (m SocketConfig_TProxyMode) IsEnabled() bool
type SocketSetting ¶
type SocketSetting struct {
// Mark of the connection. If non-zero, the value will be set to SO_MARK.
Mark uint32
// TFO is the state of TFO settings. Non supported on darwin.
Tfo SocketConfig_TCPFastOpenState
// TProxy is for enabling TProxy socket option.
Tproxy SocketConfig_TProxyMode
// ReceiveOriginalDestAddress is for enabling IP_RECVORIGDSTADDR socket
// option. This option is for UDP only.
ReceiveOriginalDestAddress bool
BindAddress []byte
BindPort uint32
AcceptProxyProtocol bool
TcpKeepAliveInterval int32
TfoQueueLength uint32
TcpKeepAliveIdle int32
BindToDevice4 uint32
BindToDevice6 uint32
// this field is only considered only on linux now
BindToDeviceName string
RxBufSize int64
TxBufSize int64
ForceBufSize bool
// laddr used when dial and listen
LocalAddr4 string
LocalAddr6 string
StatsReadCounter *atomic.Uint64
StatsWriteCounter *atomic.Uint64
Resolver *net.Resolver
FdFunc func(fd uintptr) error
}
SocketSetting is options to be applied on network sockets.
func (*SocketSetting) Copy ¶
func (s *SocketSetting) Copy() *SocketSetting
func (*SocketSetting) Dial ¶
func (s *SocketSetting) Dial(ctx context.Context, dest net1.Destination) (net.Conn, error)
func (*SocketSetting) Dulplicate ¶
func (so *SocketSetting) Dulplicate() *SocketSetting
func (*SocketSetting) GetAcceptProxyProtocol ¶
func (x *SocketSetting) GetAcceptProxyProtocol() bool
func (*SocketSetting) GetBindAddress ¶
func (x *SocketSetting) GetBindAddress() []byte
func (*SocketSetting) GetBindPort ¶
func (x *SocketSetting) GetBindPort() uint32
func (*SocketSetting) GetBindToDevice4 ¶
func (x *SocketSetting) GetBindToDevice4() uint32
func (*SocketSetting) GetBindToDevice6 ¶
func (x *SocketSetting) GetBindToDevice6() uint32
func (*SocketSetting) GetForceBufSize ¶
func (x *SocketSetting) GetForceBufSize() bool
func (*SocketSetting) GetLocalAddr4 ¶
func (x *SocketSetting) GetLocalAddr4() string
func (*SocketSetting) GetLocalAddr6 ¶
func (x *SocketSetting) GetLocalAddr6() string
func (*SocketSetting) GetMark ¶
func (x *SocketSetting) GetMark() uint32
func (*SocketSetting) GetReceiveOriginalDestAddress ¶
func (x *SocketSetting) GetReceiveOriginalDestAddress() bool
func (*SocketSetting) GetRxBufSize ¶
func (x *SocketSetting) GetRxBufSize() int64
func (*SocketSetting) GetTcpKeepAliveIdle ¶
func (x *SocketSetting) GetTcpKeepAliveIdle() int32
func (*SocketSetting) GetTcpKeepAliveInterval ¶
func (x *SocketSetting) GetTcpKeepAliveInterval() int32
func (*SocketSetting) GetTfo ¶
func (x *SocketSetting) GetTfo() SocketConfig_TCPFastOpenState
func (*SocketSetting) GetTfoQueueLength ¶
func (x *SocketSetting) GetTfoQueueLength() uint32
func (*SocketSetting) GetTproxy ¶
func (x *SocketSetting) GetTproxy() SocketConfig_TProxyMode
func (*SocketSetting) GetTxBufSize ¶
func (x *SocketSetting) GetTxBufSize() int64
func (*SocketSetting) ListenPacket ¶
func (s *SocketSetting) ListenPacket(ctx context.Context, network, address string) (net.PacketConn, error)
Click to show internal directories.
Click to hide internal directories.