vmess

package
v0.0.0-...-0299622 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package vmess implements the VMess protocol encoding and decoding. VMess is a protocol designed for encrypted communication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseUUID

func ParseUUID(s string) ([16]byte, error)

ParseUUID parses a UUID string into bytes

Types

type AddressType

type AddressType byte

AddressType represents the address type

const (
	AddressTypeIPv4   AddressType = 1
	AddressTypeDomain AddressType = 2
	AddressTypeIPv6   AddressType = 3
)

type Client

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

Client represents a VMess client

func NewClient

func NewClient(uuid [16]byte, alterID uint16, security Security) *Client

NewClient creates a new VMess client

func (*Client) Dial

func (c *Client) Dial(conn net.Conn, target string, port uint16, cmd Command) (net.Conn, error)

Dial connects to a VMess server and returns a connection

type Command

type Command byte

Command represents the VMess command type

const (
	CommandTCP Command = 1
	CommandUDP Command = 2
)

type Conn

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

Conn represents a VMess connection

func (*Conn) Read

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

Read reads data from the connection

func (*Conn) Write

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

Write writes data to the connection

type Request

type Request struct {
	Version  byte
	Command  Command
	Security Security
	Address  string
	Port     uint16
	User     *User
}

Request represents a VMess request header

type Response

type Response struct {
	ResponseHeader byte
	Command        byte
}

Response represents a VMess response header

type Security

type Security byte

Security represents the encryption method

const (
	SecurityAES128GCM        Security = 3
	SecurityChacha20Poly1305 Security = 4
	SecurityNone             Security = 5
	SecurityZero             Security = 0
)

type Server

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

Server represents a VMess server

func NewServer

func NewServer() *Server

NewServer creates a new VMess server

func (*Server) AddUser

func (s *Server) AddUser(uuid [16]byte, alterID uint16)

AddUser adds a user to the server

func (*Server) HandleConnection

func (s *Server) HandleConnection(conn net.Conn) (*Request, net.Conn, error)

HandleConnection handles an incoming VMess connection

func (*Server) RemoveUser

func (s *Server) RemoveUser(uuid [16]byte)

RemoveUser removes a user from the server

type User

type User struct {
	UUID    [16]byte
	AlterID uint16
}

User represents a VMess user

Jump to

Keyboard shortcuts

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