Versions in this module Expand all Collapse all v0 v0.1.13 Oct 17, 2024 v0.1.12 Oct 17, 2024 Changes in this version + const CacheDurationSeconds + const CipherOverhead + const CommandMux + const CommandTCP + const CommandUDP + const KDFSaltConstAEADRespHeaderLenIV + const KDFSaltConstAEADRespHeaderLenKey + const KDFSaltConstAEADRespHeaderPayloadIV + const KDFSaltConstAEADRespHeaderPayloadKey + const KDFSaltConstAuthIDEncryptionKey + const KDFSaltConstVMessAEADKDF + const KDFSaltConstVMessHeaderPayloadAEADIV + const KDFSaltConstVMessHeaderPayloadAEADKey + const KDFSaltConstVMessHeaderPayloadLengthAEADIV + const KDFSaltConstVMessHeaderPayloadLengthAEADKey + const MaxFrontHeadroom + const MaxPaddingSize + const MaxRearHeadroom + const NetworkTCP + const NetworkUDP + const OptionData + const OptionError + const ReadChunkSize + const RequestOptionAuthenticatedLength + const RequestOptionChunkMasking + const RequestOptionChunkStream + const RequestOptionConnectionReuse + const RequestOptionGlobalPadding + const SecurityTypeAes128Gcm + const SecurityTypeAuto + const SecurityTypeChacha20Poly1305 + const SecurityTypeLegacy + const SecurityTypeNone + const SecurityTypeZero + const StatusEnd + const StatusKeep + const StatusKeepAlive + const StatusNew + const Version + const WriteChunkSize + var AddressSerializer = M.NewSerializer(M.AddressFamilyByte(0x01, M.AddressFamilyIPv4), ...) + var ErrBadHeader = E.New("bad header") + var ErrBadLengthChunk = E.New("bad length chunk") + var ErrBadRequest = E.New("bad request") + var ErrBadTimestamp = E.New("bad timestamp") + var ErrBadVersion = E.New("bad version") + var ErrInvalidChecksum = E.New("vmess: invalid chunk checksum") + var ErrReplay = E.New("replayed request") + var ErrUnsupportedSecurityType = E.New("vmess: unsupported security type") + var MuxDestination = M.Socksaddr + func AlterId(user uuid.UUID) uuid.UUID + func AuthID(key [16]byte, time time.Time, buffer *buf.Buffer) + func AutoSecurityType() byte + func CreateReader(upstream io.Reader, streamReader io.Reader, requestKey []byte, ...) io.Reader + func CreateWriter(upstream io.Writer, streamWriter io.Writer, requestKey []byte, ...) io.Writer + func GenerateChacha20Poly1305Key(b []byte) []byte + func HandleMuxConnection(ctx context.Context, conn net.Conn, handler Handler) error + func KDF(key []byte, salt string, path ...[]byte) []byte + func Key(user uuid.UUID) (key [16]byte) + type AEADChunkReader struct + func NewAEADChunkReader(upstream io.Reader, cipher cipher.AEAD, nonce []byte, ...) *AEADChunkReader + func NewAes128GcmChunkReader(upstream io.Reader, key []byte, nonce []byte, globalPadding sha3.ShakeHash) *AEADChunkReader + func NewChacha20Poly1305ChunkReader(upstream io.Reader, key []byte, nonce []byte, globalPadding sha3.ShakeHash) *AEADChunkReader + func (r *AEADChunkReader) Read(p []byte) (n int, err error) + func (r *AEADChunkReader) Upstream() any + type AEADChunkWriter struct + func NewAEADChunkWriter(upstream io.Writer, cipher cipher.AEAD, nonce []byte, ...) *AEADChunkWriter + func NewAes128GcmChunkWriter(upstream io.Writer, key []byte, nonce []byte, globalPadding sha3.ShakeHash) *AEADChunkWriter + func NewChacha20Poly1305ChunkWriter(upstream io.Writer, key []byte, nonce []byte, globalPadding sha3.ShakeHash) *AEADChunkWriter + func (w *AEADChunkWriter) FrontHeadroom() int + func (w *AEADChunkWriter) RearHeadroom() int + func (w *AEADChunkWriter) Upstream() any + func (w *AEADChunkWriter) Write(p []byte) (n int, err error) + func (w *AEADChunkWriter) WriteBuffer(buffer *buf.Buffer) error + type AEADReader struct + func NewAEADReader(upstream io.Reader, cipher cipher.AEAD, nonce []byte) *AEADReader + func NewAes128GcmReader(upstream io.Reader, key []byte, nonce []byte) *AEADReader + func NewChacha20Poly1305Reader(upstream io.Reader, key []byte, nonce []byte) *AEADReader + func (r *AEADReader) Read(p []byte) (n int, err error) + func (r *AEADReader) ReadBuffer(buffer *buf.Buffer) error + func (r *AEADReader) Upstream() any + type AEADWriter struct + func NewAEADWriter(upstream io.Writer, cipher cipher.AEAD, nonce []byte) *AEADWriter + func NewAes128GcmWriter(upstream io.Writer, key []byte, nonce []byte) *AEADWriter + func NewChacha20Poly1305Writer(upstream io.Writer, key []byte, nonce []byte) *AEADWriter + func (w *AEADWriter) RearHeadroom() int + func (w *AEADWriter) Upstream() any + func (w *AEADWriter) Write(p []byte) (n int, err error) + func (w *AEADWriter) WriteBuffer(buffer *buf.Buffer) error + type Client struct + func NewClient(userId string, security string, alterId int, options ...ClientOption) (*Client, error) + func (c *Client) DialConn(upstream net.Conn, destination M.Socksaddr) (N.ExtendedConn, error) + func (c *Client) DialEarlyConn(upstream net.Conn, destination M.Socksaddr) N.ExtendedConn + func (c *Client) DialEarlyPacketConn(upstream net.Conn, destination M.Socksaddr) PacketConn + func (c *Client) DialEarlyXUDPPacketConn(upstream net.Conn, destination M.Socksaddr) PacketConn + func (c *Client) DialPacketConn(upstream net.Conn, destination M.Socksaddr) (PacketConn, error) + func (c *Client) DialXUDPPacketConn(upstream net.Conn, destination M.Socksaddr) (PacketConn, error) + type ClientOption func(*Client) + func ClientWithAuthenticatedLength() ClientOption + func ClientWithGlobalPadding() ClientOption + func ClientWithTimeFunc(timeFunc TimeFunc) ClientOption + type Handler interface + type MuxConnWrapper struct + func NewMuxConnWrapper(conn net.Conn, destination M.Socksaddr) *MuxConnWrapper + func (c *MuxConnWrapper) FrontHeadroom() int + func (c *MuxConnWrapper) Read(p []byte) (n int, err error) + func (c *MuxConnWrapper) ReadBuffer(buffer *buf.Buffer) error + func (c *MuxConnWrapper) Upstream() any + func (c *MuxConnWrapper) Write(p []byte) (n int, err error) + func (c *MuxConnWrapper) WriteBuffer(buffer *buf.Buffer) error + type PacketConn interface + type Service struct + func NewService[U comparable](handler Handler, options ...ServiceOption) *Service[U] + func (s *Service[U]) Close() error + func (s *Service[U]) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error + func (s *Service[U]) Start() error + func (s *Service[U]) UpdateUsers(userList []U, userIdList []string, alterIdList []int) error + type ServiceOption func(service *Service[string]) + func ServiceWithDisableHeaderProtection() ServiceOption + func ServiceWithTimeFunc(timeFunc TimeFunc) ServiceOption + type StreamChecksumReader struct + func NewStreamChecksumReader(reader io.Reader) *StreamChecksumReader + func (r *StreamChecksumReader) Read(p []byte) (n int, err error) + func (r *StreamChecksumReader) ReadBuffer(buffer *buf.Buffer) error + func (r *StreamChecksumReader) Upstream() any + type StreamChecksumWriter struct + func NewStreamChecksumWriter(upstream *StreamChunkWriter) *StreamChecksumWriter + func (w *StreamChecksumWriter) FrontHeadroom() int + func (w *StreamChecksumWriter) Upstream() any + func (w *StreamChecksumWriter) Write(p []byte) (n int, err error) + func (w *StreamChecksumWriter) WriteBuffer(buffer *buf.Buffer) error + type StreamChunkReader struct + func NewStreamChunkReader(upstream io.Reader, chunkMasking sha3.ShakeHash, globalPadding sha3.ShakeHash) *StreamChunkReader + func (r *StreamChunkReader) Read(p []byte) (n int, err error) + func (r *StreamChunkReader) Upstream() any + type StreamChunkWriter struct + func NewStreamChunkWriter(upstream io.Writer, chunkMasking sha3.ShakeHash, globalPadding sha3.ShakeHash) *StreamChunkWriter + func (w *StreamChunkWriter) FrontHeadroom() int + func (w *StreamChunkWriter) RearHeadroom() int + func (w *StreamChunkWriter) Upstream() any + func (w *StreamChunkWriter) Write(p []byte) (n int, err error) + func (w *StreamChunkWriter) WriteBuffer(buffer *buf.Buffer) error + func (w *StreamChunkWriter) WriteWithChecksum(checksum uint32, p []byte) (n int, err error) + type StreamReader struct + func NewStreamReader(upstream io.Reader, key []byte, iv []byte) *StreamReader + func (r *StreamReader) Read(p []byte) (n int, err error) + func (r *StreamReader) ReadBuffer(buffer *buf.Buffer) error + func (r *StreamReader) Upstream() any + type StreamWriter struct + func NewStreamWriter(upstream io.Writer, key []byte, iv []byte) *StreamWriter + func (w *StreamWriter) Upstream() any + func (w *StreamWriter) Write(p []byte) (n int, err error) + func (w *StreamWriter) WriteBuffer(buffer *buf.Buffer) error + type TimeFunc = func() time.Time + type XUDPConn struct + func NewXUDPConn(conn net.Conn, destination M.Socksaddr) *XUDPConn + func (c *XUDPConn) FrontHeadroom() int + func (c *XUDPConn) NeedAdditionalReadDeadline() bool + func (c *XUDPConn) NeedHandshake() bool + func (c *XUDPConn) Read(p []byte) (n int, err error) + func (c *XUDPConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) + func (c *XUDPConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error) + func (c *XUDPConn) Upstream() any + func (c *XUDPConn) Write(p []byte) (n int, err error) + func (c *XUDPConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error + func (c *XUDPConn) WriteTo(p []byte, addr net.Addr) (n int, err error)