Documentation ¶
Index ¶
- Constants
- Variables
- func NewDialTimeoutContext() (context.Context, context.CancelFunc)
- func NewDialTimeoutContextFrom(ctx context.Context) (context.Context, context.CancelFunc)
- type Conn
- type Dialer
- type FakeNetConn
- type FakeNetPacketConn
- type FullConn
- type MagicNetwork
- type PacketConn
- type ReadWrapper
Constants ¶
View Source
const MagicNetworkType = 0
Variables ¶
View Source
var (
DialTimeout = 10 * time.Second
)
View Source
var SoMark = func(fd int, mark int) error { if err := syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, fwmarkIoctl, mark); err != nil { return err } return nil }
SoMark is replacable. Replacibility is useful for Android.
View Source
var SoMarkControl = func(c syscall.RawConn, mark int) error { var sockOptErr error controlErr := c.Control(func(fd uintptr) { err := unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, fwmarkIoctl, mark) if err != nil { sockOptErr = fmt.Errorf("error setting SO_MARK socket option: %w", err) } }) if controlErr != nil { return fmt.Errorf("error invoking socket control function: %w", controlErr) } return sockOptErr }
SoMarkControl is replacable. Replacibility is useful for Android.
View Source
var (
UnknownMagicNetworkEncodingError = fmt.Errorf("unknown magic network encoding")
)
View Source
var UnsupportedTunnelTypeError = net.UnknownNetworkError("unsupported tunnel type")
Functions ¶
func NewDialTimeoutContext ¶
func NewDialTimeoutContext() (context.Context, context.CancelFunc)
Types ¶
type Dialer ¶
type Dialer interface {
DialContext(ctx context.Context, network, addr string) (c Conn, err error)
}
A Dialer is a means to establish a connection. Custom dialers should also implement ContextDialer.
type FakeNetConn ¶
func (*FakeNetConn) LocalAddr ¶
func (conn *FakeNetConn) LocalAddr() net.Addr
func (*FakeNetConn) RemoteAddr ¶
func (conn *FakeNetConn) RemoteAddr() net.Addr
type FakeNetPacketConn ¶
type FakeNetPacketConn interface { net.PacketConn net.Conn }
func NewFakeNetPacketConn ¶
func NewFakeNetPacketConn(conn PacketConn, LAddr net.Addr, RAddr net.Addr) FakeNetPacketConn
type FullConn ¶
type FullConn interface { Conn PacketConn }
type MagicNetwork ¶
func ParseMagicNetwork ¶
func ParseMagicNetwork(network string) (mn *MagicNetwork, err error)
func (MagicNetwork) Encode ¶
func (mn MagicNetwork) Encode() string
type PacketConn ¶
type PacketConn interface { Read(b []byte) (n int, err error) Write(b []byte) (n int, err error) ReadFrom(p []byte) (n int, addr netip.AddrPort, err error) WriteTo(p []byte, addr string) (n int, err error) Close() error SetDeadline(t time.Time) error SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error }
Click to show internal directories.
Click to hide internal directories.