codec

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: GPL-3.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Socks5Version = byte(0x05)
	NoAuth        = byte(0x00)
)

socks5 const

View Source
const (
	SuccessReply uint8 = iota
)

send reply byte

Variables

This section is empty.

Functions

func DecodeUint32

func DecodeUint32(uintByte []byte) uint32

func DialTrojan

func DialTrojan(config *client.Config, metadata *Metadata) (outbound net.Conn, err error)

DialTrojan dial trojan remote

func EncodeUint32

func EncodeUint32(i uint32) []byte

func PeekTrojan

func PeekTrojan(bufr *bufio.Reader, conn net.Conn) (bool, error)

PeekTrojan peek trojan protocol

func ReadByte

func ReadByte(r io.Reader) (byte, error)

func ReadUint32

func ReadUint32(r io.Reader) (uint32, error)

Types

type Address

type Address struct {
	DomainName  string
	Port        int
	NetworkType string
	net.IP
	AddressType
}

func NewAddressFromAddr

func NewAddressFromAddr(network string, addr string) (*Address, error)

func NewAddressFromHostPort

func NewAddressFromHostPort(network string, host string, port int) *Address

func (*Address) Network

func (a *Address) Network() string

func (*Address) ReadFrom

func (a *Address) ReadFrom(r io.Reader) error

func (*Address) ResolveIP

func (a *Address) ResolveIP() (net.IP, error)

func (*Address) String

func (a *Address) String() string

func (*Address) WriteTo

func (a *Address) WriteTo(w io.Writer) error

type AddressType

type AddressType byte
const (
	IPv4       AddressType = 1
	DomainName AddressType = 3
	IPv6       AddressType = 4
)

trojan AddressType

type Codec

type Codec interface {
	Encode() ([]byte, error)
	Decode(reader io.Reader) error
}

Codec interface

type Metadata

type Metadata struct {
	*Address
	// contains filtered or unexported fields
}

Metadata struct

func (*Metadata) Network

func (r *Metadata) Network() string

Network network string

func (*Metadata) ReadFrom

func (r *Metadata) ReadFrom(rr io.Reader) error

ReadFrom metadata read byte

func (*Metadata) String

func (r *Metadata) String() string

String Address string

func (*Metadata) WriteTo

func (r *Metadata) WriteTo(w io.Writer) error

WriteTo metadata write byte

type PeekReader

type PeekReader struct {
	R *bufio.Reader
	I int
}

func (*PeekReader) Read

func (p *PeekReader) Read(b []byte) (n int, err error)

type Socks5

type Socks5 struct {
	Conn     net.Conn
	Metadata *Metadata
}

Socks5 struct

func (*Socks5) HandleHandshake

func (s *Socks5) HandleHandshake() error

HandleHandshake handshake

func (*Socks5) LSTRequest

func (s *Socks5) LSTRequest() (err error)

LSTRequest lst

func (*Socks5) SendReply

func (s *Socks5) SendReply(resp uint8) error

SendReply send reply byte

type Trojan

type Trojan struct {
	Hash     string
	Metadata *Metadata
}

Trojan struct

func (*Trojan) Decode

func (s *Trojan) Decode(reader io.Reader) error

Decode read byte trojan

func (*Trojan) Encode

func (s *Trojan) Encode() ([]byte, error)

Encode write byte trojan

Jump to

Keyboard shortcuts

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