mux

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2022 License: GPL-2.0 Imports: 19 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Destination = M.Socksaddr{
	Fqdn: "sp.mux.sing-box.arpa",
	Port: 444,
}

Functions

func EncodeRequest

func EncodeRequest(buffer *buf.Buffer, request Request)

func EncodeStreamRequest

func EncodeStreamRequest(request StreamRequest, buffer *buf.Buffer)

func NewClientWithOptions

func NewClientWithOptions(ctx context.Context, dialer N.Dialer, options option.MultiplexOptions) (N.Dialer, error)

func NewConnection

func NewConnection(ctx context.Context, router adapter.Router, errorHandler E.Handler, logger log.ContextLogger, conn net.Conn, metadata adapter.InboundContext) error

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, dialer N.Dialer, protocol Protocol, maxConnections int, minStreams int, maxStreams int) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialContext

func (c *Client) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error)

func (*Client) ListenPacket

func (c *Client) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)

type ClientConn

type ClientConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*ClientConn) LocalAddr

func (c *ClientConn) LocalAddr() net.Addr

func (*ClientConn) Read

func (c *ClientConn) Read(b []byte) (n int, err error)

func (*ClientConn) ReadFrom

func (c *ClientConn) ReadFrom(r io.Reader) (n int64, err error)

func (*ClientConn) ReaderReplaceable

func (c *ClientConn) ReaderReplaceable() bool

func (*ClientConn) RemoteAddr

func (c *ClientConn) RemoteAddr() net.Addr

func (*ClientConn) Upstream

func (c *ClientConn) Upstream() any

func (*ClientConn) Write

func (c *ClientConn) Write(b []byte) (n int, err error)

func (*ClientConn) WriteTo

func (c *ClientConn) WriteTo(w io.Writer) (n int64, err error)

func (*ClientConn) WriterReplaceable

func (c *ClientConn) WriterReplaceable() bool

type ClientPacketAddrConn

type ClientPacketAddrConn struct {
	N.ExtendedConn
	// contains filtered or unexported fields
}

func (*ClientPacketAddrConn) FrontHeadroom

func (c *ClientPacketAddrConn) FrontHeadroom() int

func (*ClientPacketAddrConn) LocalAddr

func (c *ClientPacketAddrConn) LocalAddr() net.Addr

func (*ClientPacketAddrConn) ReadFrom

func (c *ClientPacketAddrConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*ClientPacketAddrConn) ReadPacket

func (c *ClientPacketAddrConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error)

func (*ClientPacketAddrConn) Upstream

func (c *ClientPacketAddrConn) Upstream() any

func (*ClientPacketAddrConn) WritePacket

func (c *ClientPacketAddrConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error

func (*ClientPacketAddrConn) WriteTo

func (c *ClientPacketAddrConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

type ClientPacketConn

type ClientPacketConn struct {
	N.ExtendedConn
	// contains filtered or unexported fields
}

func (*ClientPacketConn) FrontHeadroom

func (c *ClientPacketConn) FrontHeadroom() int

func (*ClientPacketConn) LocalAddr

func (c *ClientPacketConn) LocalAddr() net.Addr

func (*ClientPacketConn) Read

func (c *ClientPacketConn) Read(b []byte) (n int, err error)

func (*ClientPacketConn) RemoteAddr

func (c *ClientPacketConn) RemoteAddr() net.Addr

func (*ClientPacketConn) Upstream

func (c *ClientPacketConn) Upstream() any

func (*ClientPacketConn) Write

func (c *ClientPacketConn) Write(b []byte) (n int, err error)

func (*ClientPacketConn) WriteBuffer

func (c *ClientPacketConn) WriteBuffer(buffer *buf.Buffer) error

func (*ClientPacketConn) WritePacket

func (c *ClientPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error

type Protocol

type Protocol byte
const (
	ProtocolSMux Protocol = iota
	ProtocolYAMux
)

func ParseProtocol

func ParseProtocol(name string) (Protocol, error)

func (Protocol) String

func (p Protocol) String() string

type Request

type Request struct {
	Protocol Protocol
}

func ReadRequest

func ReadRequest(reader io.Reader) (*Request, error)

type ServerConn

type ServerConn struct {
	N.ExtendedConn
	// contains filtered or unexported fields
}

func (*ServerConn) FrontHeadroom

func (c *ServerConn) FrontHeadroom() int

func (*ServerConn) HandshakeFailure

func (c *ServerConn) HandshakeFailure(err error) error

func (*ServerConn) Upstream

func (c *ServerConn) Upstream() any

func (*ServerConn) Write

func (c *ServerConn) Write(b []byte) (n int, err error)

func (*ServerConn) WriteBuffer

func (c *ServerConn) WriteBuffer(buffer *buf.Buffer) error

type ServerPacketAddrConn

type ServerPacketAddrConn struct {
	N.ExtendedConn
	// contains filtered or unexported fields
}

func (*ServerPacketAddrConn) FrontHeadroom

func (c *ServerPacketAddrConn) FrontHeadroom() int

func (*ServerPacketAddrConn) HandshakeFailure

func (c *ServerPacketAddrConn) HandshakeFailure(err error) error

func (*ServerPacketAddrConn) ReadPacket

func (c *ServerPacketAddrConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error)

func (*ServerPacketAddrConn) Upstream

func (c *ServerPacketAddrConn) Upstream() any

func (*ServerPacketAddrConn) WritePacket

func (c *ServerPacketAddrConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error

type ServerPacketConn

type ServerPacketConn struct {
	N.ExtendedConn
	// contains filtered or unexported fields
}

func (*ServerPacketConn) FrontHeadroom

func (c *ServerPacketConn) FrontHeadroom() int

func (*ServerPacketConn) HandshakeFailure

func (c *ServerPacketConn) HandshakeFailure(err error) error

func (*ServerPacketConn) ReadPacket

func (c *ServerPacketConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error)

func (*ServerPacketConn) Upstream

func (c *ServerPacketConn) Upstream() any

func (*ServerPacketConn) WritePacket

func (c *ServerPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error

type StreamRequest

type StreamRequest struct {
	Network     string
	Destination M.Socksaddr
	PacketAddr  bool
}

func ReadStreamRequest

func ReadStreamRequest(reader io.Reader) (*StreamRequest, error)

type StreamResponse

type StreamResponse struct {
	Status  uint8
	Message string
}

func ReadStreamResponse

func ReadStreamResponse(reader io.Reader) (*StreamResponse, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL