vmess

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptionChunkStream  byte = 1
	OptionChunkMasking byte = 4
)

Request Options

View Source
const (
	CommandTCP byte = 1
	CommandUDP byte = 2
)

Command types

View Source
const (
	AtypIPv4       byte = 1
	AtypDomainName byte = 2
	AtypIPv6       byte = 3
)

Addr types

View Source
const (
	IDBytesLen = 16
)

ID cmdKey length

View Source
const Version byte = 1

Version of vmess

Variables

View Source
var CipherMapping = map[string]byte{
	"none":              SecurityNone,
	"aes-128-gcm":       SecurityAES128GCM,
	"chacha20-poly1305": SecurityCHACHA20POLY1305,
}

CipherMapping return

Functions

func StreamH2Conn

func StreamH2Conn(conn net.Conn, cfg *H2Config) (net.Conn, error)

func StreamHTTPConn

func StreamHTTPConn(conn net.Conn, cfg *HTTPConfig) net.Conn

func StreamTLSConn

func StreamTLSConn(conn net.Conn, cfg *TLSConfig) (net.Conn, error)

func StreamWebsocketConn

func StreamWebsocketConn(conn net.Conn, c *WebsocketConfig) (net.Conn, error)

Types

type Client

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

Client is vmess connection generator

func NewClient

func NewClient(config Config) (*Client, error)

NewClient return Client instance

func (*Client) StreamConn

func (c *Client) StreamConn(conn net.Conn, dst *DstAddr) (net.Conn, error)

StreamConn return a Conn with net.Conn and DstAddr

type Config

type Config struct {
	UUID     string
	AlterID  uint16
	Security string
	Port     string
	HostName string
	IsAead   bool
}

Config of vmess

type Conn

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

Conn wrapper a net.Conn with vmess protocol

func (*Conn) Read

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

func (*Conn) Write

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

type DstAddr

type DstAddr struct {
	UDP      bool
	AddrType byte
	Addr     []byte
	Port     uint
}

DstAddr store destination address

type H2Config

type H2Config struct {
	Hosts []string
	Path  string
}

type HTTPConfig

type HTTPConfig struct {
	Method  string
	Host    string
	Path    []string
	Headers map[string][]string
}

type ID

type ID struct {
	UUID   *uuid.UUID
	CmdKey []byte
}

The ID of en entity, in the form of a UUID.

type Security

type Security = byte

Security type vmess

const (
	SecurityAES128GCM        Security = 3
	SecurityCHACHA20POLY1305 Security = 4
	SecurityNone             Security = 5
)

Cipher types

type TLSConfig

type TLSConfig struct {
	Host           string
	SkipCertVerify bool
	NextProtos     []string
}

type WebsocketConfig

type WebsocketConfig struct {
	Host                string
	Port                string
	Path                string
	Headers             http.Header
	TLS                 bool
	TLSConfig           *tls.Config
	MaxEarlyData        int
	EarlyDataHeaderName string
}

Jump to

Keyboard shortcuts

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