codec

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectCommand   = uint8(1)
	BindCommand      = uint8(2)
	AssociateCommand = uint8(3)
)
View Source
const (
	NoAuth = byte(0x00)
)
View Source
const (
	SuccessReply uint8 = iota
)

Variables

This section is empty.

Functions

func DialTrojan

func DialTrojan(metadata *Metadata) (net.Conn, error)

func ExitHash

func ExitHash(hash []byte) (*server.Password, bool)

func PeekTrojan

func PeekTrojan(bufr *bufio.Reader, conn net.Conn) 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
)

type Codec

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

type Command

type Command byte
const (
	Connect   Command = 1
	Associate Command = 3
	Mux       Command = 0x7f
)

type Metadata

type Metadata struct {
	Command
	*Address
}

func (*Metadata) Network

func (r *Metadata) Network() string

func (*Metadata) ReadFrom

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

func (*Metadata) String

func (r *Metadata) String() string

func (*Metadata) WriteTo

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

type Socks5

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

func (*Socks5) DialSendTrojan

func (s *Socks5) DialSendTrojan(network, addr string) (net.Conn, error)

func (*Socks5) HandleHandshake

func (s *Socks5) HandleHandshake() error

func (*Socks5) LSTRequest

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

func (*Socks5) SendReply

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

type Trojan

type Trojan struct {
	Hash     string
	Metadata *Metadata
}

func (*Trojan) Decode

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

func (*Trojan) Encode

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

Jump to

Keyboard shortcuts

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