vmess

package
v1.0.6-rc5 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TCP tunnel.Command = 1
	UDP tunnel.Command = 2
)
View Source
const (
	OptBasicFormat byte = 0 // 不加密传输
	OptChunkStream byte = 1 // 分块传输,每个分块使用如下Security方法加密

)

Request Options

View Source
const (
	SecurityAES128GCM        byte = 3
	SecurityChacha20Poly1305 byte = 4
	SecurityNone             byte = 5
)

Security types

View Source
const (
	CmdTCP byte = 1
	CmdUDP byte = 2
)

CMD types

View Source
const (
	AtypIP4    byte = 1
	AtypDomain byte = 2
	AtypIP6    byte = 3
)

Atyp

View Source
const Name = "VMESS"

Variables

This section is empty.

Functions

func AEADReader

func AEADReader(r io.Reader, aead cipher.AEAD, iv []byte) io.Reader

AEADReader returns a aead reader

func AEADWriter

func AEADWriter(w io.Writer, aead cipher.AEAD, iv []byte) io.Writer

AEADWriter returns a aead writer

func ChunkedReader

func ChunkedReader(r io.Reader) io.Reader

ChunkedReader returns a chunked reader

func ChunkedWriter

func ChunkedWriter(w io.Writer) io.Writer

ChunkedWriter returns a chunked writer

func GetBuffer

func GetBuffer(size int) []byte

func GetKey

func GetKey(uuid [16]byte) []byte

GetKey returns the key of AES-128-CFB encrypter Key:MD5(UUID + []byte('c48619fe-8f02-49e0-b9e9-edf763e17e21'))

func GetWriteBuffer

func GetWriteBuffer() *bytes.Buffer

func InitBufPools

func InitBufPools() []sync.Pool

func InitWriteBufPool

func InitWriteBufPool() sync.Pool

func PutBuffer

func PutBuffer(buf []byte) error

func PutWriteBuffer

func PutWriteBuffer(buf *bytes.Buffer)

func StrToUUID

func StrToUUID(s string) (uuid [16]byte, err error)

StrToUUID converts string to uuid

func TimestampHash

func TimestampHash(unixSec int64) []byte

TimestampHash returns the iv of AES-128-CFB encrypter IV:MD5(X + X + X + X),X = []byte(timestamp.now) (8 bytes, Big Endian)

Types

type APIConfig added in v1.0.7

type APIConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
}

type Client

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

func NewClient

func NewClient(ctx context.Context, client tunnel.Client) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialConn

func (c *Client) DialConn(addr *tunnel.Address, t tunnel.Tunnel) (tunnel.Conn, error)

func (*Client) DialPacket

func (c *Client) DialPacket(t tunnel.Tunnel) (tunnel.PacketConn, error)

type Config

type Config struct {
	LocalHost  string      `json:"local_addr" yaml:"local-addr"`
	LocalPort  int         `json:"local_port" yaml:"local-port"`
	RemoteHost string      `json:"remote_addr" yaml:"remote-addr"`
	RemotePort int         `json:"remote_port" yaml:"remote-port"`
	UUID       string      `json:"uuid" yaml:"uuid"`
	AlterID    int         `json:"alterId" yaml:"alterId"`
	Security   string      `json:"security" yaml:"security"`
	Port       string      `json:"port" yaml:"port"`
	HostName   string      `json:"hostName" yaml:"hostName"`
	IsAead     bool        `json:"isAead" yaml:"isAead"`
	MySQL      MySQLConfig `json:"mysql" yaml:"mysql"`
	API        APIConfig   `json:"api" yaml:"api"`
}

type InboundConn

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

InboundConn is a vmess inbound connection

func (*InboundConn) Close added in v1.0.7

func (c *InboundConn) Close() error

func (*InboundConn) Metadata

func (c *InboundConn) Metadata() *tunnel.Metadata

func (*InboundConn) Read

func (c *InboundConn) Read(p []byte) (n int, err error)

func (*InboundConn) Write

func (c *InboundConn) Write(p []byte) (int, error)

type MySQLConfig added in v1.0.7

type MySQLConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
}

type OutboundConn

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

func (*OutboundConn) Auth

func (vc *OutboundConn) Auth() error

func (*OutboundConn) DecodeRespHeader

func (vc *OutboundConn) DecodeRespHeader() error

func (*OutboundConn) Metadata

func (c *OutboundConn) Metadata() *tunnel.Metadata

func (*OutboundConn) Read

func (vc *OutboundConn) Read(b []byte) (int, error)

func (*OutboundConn) Request

func (vc *OutboundConn) Request() error

func (*OutboundConn) Write

func (vc *OutboundConn) Write(b []byte) (int, error)

type Server

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

func NewServer

func NewServer(ctx context.Context, underlay tunnel.Server) (*Server, error)

func (*Server) AcceptConn

func (s *Server) AcceptConn(t tunnel.Tunnel) (tunnel.Conn, error)

func (*Server) AcceptPacket

func (s *Server) AcceptPacket(t tunnel.Tunnel) (tunnel.PacketConn, error)

func (*Server) AddUser added in v1.0.7

func (s *Server) AddUser(uuid string) error

func (*Server) Close

func (s *Server) Close() error

func (*Server) DelUser added in v1.0.7

func (s *Server) DelUser(uuid string) error

type SessionId

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

type Tunnel

type Tunnel struct{}

func (*Tunnel) Name

func (c *Tunnel) Name() string

func (*Tunnel) NewClient

func (c *Tunnel) NewClient(ctx context.Context, client tunnel.Client) (tunnel.Client, error)

func (*Tunnel) NewServer

func (c *Tunnel) NewServer(ctx context.Context, server tunnel.Server) (tunnel.Server, error)

type User

type User struct {
	UUID   [16]byte
	CmdKey [16]byte
}

Vmess user

func NewUser

func NewUser(uuid [16]byte) *User

func (User) Add added in v1.0.7

func (u User) Add()

func (*User) GenAlterIDUsers

func (u *User) GenAlterIDUsers(alterID int) []*User

GenAlterIDUsers generates users according to primary user's id and alterID

type UserAtTime

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

type Users added in v1.0.7

type Users []*User

Jump to

Keyboard shortcuts

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