Documentation ¶
Index ¶
Constants ¶
View Source
const ( FeatureUserAuth = 0x01 FeatureAddr = 0x02 )
View Source
const ( AddrIPv4 uint8 = 1 AddrDomain uint8 = 3 AddrIPv6 uint8 = 4 )
View Source
const ( CONNECT uint8 = 0x01 BIND uint8 = 0x02 ASSOCIATE uint8 = 0x03 CmdMask uint8 = 0x0F )
request commands
View Source
const ( StatusOK = 0x00 StatusBadRequest = 0x01 StatusForbidden = 0x03 StatusTimeout = 0x04 StatusHostUnreachable = 0x06 StatusNetworkUnreachable = 0x07 )
response status list
View Source
const ( // FUDP is a flag indicating that the request is UDP-oriented. FUDP uint8 = 0x80 )
View Source
const (
Version1 = 0x01
)
Variables ¶
View Source
var ( ErrShortBuffer = errors.New("short buffer") ErrBadAddrType = errors.New("bad address type") )
View Source
var (
ErrBadVersion = errors.New("bad version")
)
Functions ¶
This section is empty.
Types ¶
type AddrFeature ¶
AddrFeature is a relay feature,
Protocol spec:
+------+----------+----------+ | ATYP | ADDR | PORT | +------+----------+----------+ | 1 | Variable | 2 | +------+----------+----------+ ATYP - address type, 0x01 - IPv4, 0x03 - domain name, 0x04 - IPv6. 1 byte. ADDR - host address, IPv4 (4 bytes), IPV6 (16 bytes) or doman name based on ATYP. For domain name, the first byte is the length of the domain name. PORT - port number, 2 bytes.
func (*AddrFeature) Decode ¶
func (f *AddrFeature) Decode(b []byte) error
func (*AddrFeature) Encode ¶
func (f *AddrFeature) Encode() ([]byte, error)
func (*AddrFeature) ParseFrom ¶
func (f *AddrFeature) ParseFrom(address string) error
func (*AddrFeature) Type ¶
func (f *AddrFeature) Type() uint8
type Feature ¶
Feature represents a feature the client or server owned.
Protocol spec:
+------+----------+------+ | TYPE | LEN | FEATURE | +------+-------+---------+ | 1 | 2 | VAR | +------+-------+---------+ TYPE - feature type, 1 byte. LEN - length of feature data, 2 bytes. FEATURE - feature data.
type Request ¶
Request is a relay client request.
Protocol spec:
+-----+---------+----+---+-----+----+ | VER | FLAGS | FEALEN | FEATURES | +-----+---------+----+---+-----+----+ | 1 | 1 | 2 | VAR | +-----+---------+--------+----------+ VER - protocol version, 1 byte. FLAGS - flags, 1 byte. FEALEN - length of features, 2 bytes. FEATURES - feature list.
type Response ¶
Response is a relay server response.
Protocol spec:
+-----+--------+----+---+-----+----+ | VER | STATUS | FEALEN | FEATURES | +-----+--------+----+---+-----+----+ | 1 | 1 | 2 | VAR | +-----+--------+--------+----------+ VER - protocol version, 1 byte. STATUS - server status, 1 byte. FEALEN - length of features, 2 bytes. FEATURES - feature list.
type UserAuthFeature ¶
UserAuthFeature is a relay feature, it contains the username and password for user authentication on server side.
Protocol spec:
+------+----------+------+----------+ | ULEN | UNAME | PLEN | PASSWD | +------+----------+------+----------+ | 1 | 0 to 255 | 1 | 1 to 255 | +------+----------+------+----------+ ULEN - length of username field, 1 byte. UNAME - username, variable length, 0 to 255 bytes, 0 means no username. PLEN - length of password field, 1 byte. PASSWD - password, variable length, 0 to 255 bytes, 0 means no password.
func (*UserAuthFeature) Decode ¶
func (f *UserAuthFeature) Decode(b []byte) error
func (*UserAuthFeature) Encode ¶
func (f *UserAuthFeature) Encode() ([]byte, error)
func (*UserAuthFeature) Type ¶
func (f *UserAuthFeature) Type() uint8
Click to show internal directories.
Click to hide internal directories.