vless

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

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

CMD types.

View Source
const Version byte = 0

Variables

This section is empty.

Functions

func NewVLessDialer

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

NewVLessDialer returns a vless proxy dialer.

func ParseAddr

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

ParseAddr parses the address in string s.

func StrToUUID

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

StrToUUID converts string to uuid. s fomat: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"

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 Conn

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

Conn is a vless client connection.

func ClientConn

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

ClientConn returns a new vless client conn.

func (*Conn) Read

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

type PktConn

type PktConn struct {
	net.Conn
}

PktConn .

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 VLess

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

VLess struct.

func NewVLess

func NewVLess(s string, d proxy.Dialer) (*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.

Jump to

Keyboard shortcuts

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