go-socks5/statute/statute.go

61 lines
1.1 KiB
Go
Raw Normal View History

2020-08-05 05:17:05 +00:00
package statute
2020-08-10 00:39:51 +00:00
import (
"errors"
)
2020-08-06 02:12:46 +00:00
// VersionSocks5 socks protocol version
2020-08-06 01:32:19 +00:00
const VersionSocks5 = byte(0x05)
// request command defined
const (
CommandConnect = byte(0x01)
CommandBind = byte(0x02)
CommandAssociate = byte(0x03)
)
// method defined
2020-08-05 05:17:05 +00:00
const (
MethodNoAuth = byte(0x00)
2020-08-06 01:20:43 +00:00
MethodGSSAPI = byte(0x01) // TODO: not support now
2020-08-05 05:17:05 +00:00
MethodUserPassAuth = byte(0x02)
MethodNoAcceptable = byte(0xff)
)
2020-08-06 01:32:19 +00:00
// address type defined
2020-08-05 05:17:05 +00:00
const (
ATYPIPv4 = byte(0x01)
ATYPDomain = byte(0x03)
ATYPIPv6 = byte(0x04)
)
// reply status
const (
RepSuccess uint8 = iota
RepServerFailure
RepRuleFailure
RepNetworkUnreachable
RepHostUnreachable
RepConnectionRefused
RepTTLExpired
RepCommandNotSupported
RepAddrTypeNotSupported
// 0x09 - 0xff unassigned
)
2020-08-06 01:32:19 +00:00
// auth defined
const (
// user password version
UserPassAuthVersion = byte(0x01)
// auth status
AuthSuccess = byte(0x00)
AuthFailure = byte(0x01)
)
2020-08-10 00:39:51 +00:00
// error defined
var (
2020-08-30 03:15:05 +00:00
ErrUnrecognizedAddrType = errors.New("unrecognized address type")
2020-08-10 00:39:51 +00:00
ErrNotSupportVersion = errors.New("not support version")
ErrNotSupportMethod = errors.New("not support method")
)