vless

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const MaxHostLen = 255

MaxHostLen is the maximum size of host in bytes.

View Source
const Version byte = 0

Version of vless protocol.

Variables

This section is empty.

Functions

func AddrString added in v0.11.1

func AddrString(atyp Atyp, addr Addr, port Port) string

AddrString returns a addr string in format of "host:port".

func NewVLessDialer

func NewVLessDialer(s string, dialer proxy.Dialer) (proxy.Dialer, error)

NewVLessDialer returns a vless proxy dialer.

func NewVLessServer added in v0.11.1

func NewVLessServer(s string, p proxy.Proxy) (proxy.Server, error)

NewVLessServer returns a vless proxy server.

func ParseAddr

func ParseAddr(s string) (Atyp, Addr, Port, error)

ParseAddr parses the address in string s.

func ReadAddr added in v0.11.1

func ReadAddr(r io.Reader) (atyp Atyp, host Addr, port Port, err error)

ReadAddr reads just enough bytes from r to get addr.

func ReadAddrString added in v0.11.1

func ReadAddrString(r io.Reader) (string, error)

ReadAddrString reads just enough bytes from r to get addr string.

func StrToUUID

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

StrToUUID converts string to uuid.

Types

type Addr

type Addr []byte

Addr is vless addr.

type Atyp

type Atyp byte

Atyp is vless addr type.

const (
	AtypErr    Atyp = 0
	AtypIP4    Atyp = 1
	AtypDomain Atyp = 2
	AtypIP6    Atyp = 3
)

Atyp

type ClientConn

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

ClientConn is a vless client connection.

func NewClientConn added in v0.11.1

func NewClientConn(c net.Conn, uuid [16]byte, network, target string) (*ClientConn, error)

NewClientConn returns a new vless client conn.

func (*ClientConn) Read added in v0.11.1

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

type CmdType added in v0.11.1

type CmdType byte

CmdType is vless cmd type.

const (
	CmdErr CmdType = 0
	CmdTCP CmdType = 1
	CmdUDP CmdType = 2
)

CMD types.

type PktConn

type PktConn struct{ net.Conn }

PktConn is a udp Packet.Conn.

func NewPktConn

func NewPktConn(c net.Conn) *PktConn

NewPktConn returns a PktConn.

func (*PktConn) ReadFrom

func (pc *PktConn) ReadFrom(b []byte) (int, net.Addr, error)

ReadFrom implements the necessary function of net.PacketConn. TODO: we know that we use it in proxy.RelayUDP and the length of b is enough, check it later.

func (*PktConn) WriteTo

func (pc *PktConn) WriteTo(b []byte, addr net.Addr) (int, error)

WriteTo implements the necessary function of net.PacketConn.

type Port

type Port uint16

Port is vless addr port.

type ServerConn added in v0.11.1

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

ServerConn is a vless client connection.

func NewServerConn added in v0.11.1

func NewServerConn(c net.Conn) *ServerConn

NewServerConn returns a new vless client conn.

func (*ServerConn) Write added in v0.11.1

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

type VLess

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

VLess struct.

func NewVLess

func NewVLess(s string, d proxy.Dialer, p proxy.Proxy) (*VLess, error)

NewVLess returns a vless proxy.

func (*VLess) Addr

func (s *VLess) Addr() string

Addr returns forwarder's address.

func (*VLess) Dial

func (s *VLess) Dial(network, addr string) (net.Conn, error)

Dial connects to the address addr on the network net via the proxy.

func (*VLess) DialUDP

func (s *VLess) DialUDP(network, addr string) (net.PacketConn, net.Addr, error)

DialUDP connects to the given address via the proxy.

func (*VLess) ListenAndServe added in v0.11.1

func (s *VLess) ListenAndServe()

ListenAndServe listen and serves connections.

func (*VLess) Serve added in v0.11.1

func (s *VLess) Serve(c net.Conn)

Serve serves a connection.

func (*VLess) ServeUoT added in v0.11.1

func (s *VLess) ServeUoT(c net.Conn, tgt string)

ServeUoT serves udp over tcp requests.

Jump to

Keyboard shortcuts

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