Documentation ¶
Overview ¶
Package socks is a generated GoMock package.
Index ¶
- type AddrType
- type AssociateCommand
- type AuthState
- type AuthType
- type Authentication
- type Authenticator
- type BindCommand
- type Cmd
- type ConnectCommand
- type Handshake
- type MockAuthenticator
- type MockAuthenticatorMockRecorder
- type Process
- func (s *Process) Accept(session *event.Session) error
- func (s *Process) Active(session *event.Session, _ any) (any, error)
- func (s *Process) AddAuthenticator(authenticator Authenticator)
- func (s *Process) Disconnect(_ *event.Session) error
- func (s *Process) RuleCheck(request *Request, response *Response) error
- func (s *Process) SetAssociate(associate AssociateCommand)
- func (s *Process) SetBind(bind BindCommand)
- func (s *Process) SetConnect(connect ConnectCommand)
- func (s *Process) SetNoAuth(noAuth bool)
- type Request
- type ResType
- type Response
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssociateCommand ¶
type Authentication ¶
type Authentication struct {
// contains filtered or unexported fields
}
Authentication 身份认证
func NewAuthentication ¶
func NewAuthentication() *Authentication
func (*Authentication) AddAuthenticator ¶
func (a *Authentication) AddAuthenticator(authenticator Authenticator)
AddAuthenticator 添加认证器
func (*Authentication) Auth ¶
func (a *Authentication) Auth(handshake *Handshake) error
Auth 身份认证, 按照客户端的认证方法顺序匹配,一旦匹配到合适的认证方式, 则终止匹配, 然后执行身份验证并返回结果
func (*Authentication) MatchAuthenticator ¶
func (a *Authentication) MatchAuthenticator(authType AuthType) Authenticator
MatchAuthenticator 匹配认证器
func (*Authentication) SetNoAuth ¶
func (a *Authentication) SetNoAuth(noAuth bool)
SetNoAuth 是否允许无认证
type Authenticator ¶
type Authenticator interface { AuthMethod() AuthType // 支持的认证类型 Challenge(user, pass string) bool // 认证结果 }
Authenticator 认证器接口
type BindCommand ¶
type ConnectCommand ¶
type Handshake ¶
type Handshake struct {
// contains filtered or unexported fields
}
Handshake socks握手对象
func (*Handshake) AddAuthType ¶
AddAuthType 添加认证类型
type MockAuthenticator ¶
type MockAuthenticator struct {
// contains filtered or unexported fields
}
MockAuthenticator is a mock of Authenticator interface.
func NewMockAuthenticator ¶
func NewMockAuthenticator(ctrl *gomock.Controller) *MockAuthenticator
NewMockAuthenticator creates a new mock instance.
func (*MockAuthenticator) AuthMethod ¶
func (m *MockAuthenticator) AuthMethod() AuthType
AuthMethod mocks base method.
func (*MockAuthenticator) Challenge ¶
func (m *MockAuthenticator) Challenge(user, pass string) bool
Challenge mocks base method.
func (*MockAuthenticator) EXPECT ¶
func (m *MockAuthenticator) EXPECT() *MockAuthenticatorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAuthenticatorMockRecorder ¶
type MockAuthenticatorMockRecorder struct {
// contains filtered or unexported fields
}
MockAuthenticatorMockRecorder is the mock recorder for MockAuthenticator.
func (*MockAuthenticatorMockRecorder) AuthMethod ¶
func (mr *MockAuthenticatorMockRecorder) AuthMethod() *gomock.Call
AuthMethod indicates an expected call of AuthMethod.
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
func NewProcess ¶
func NewProcess() *Process
func (*Process) AddAuthenticator ¶
func (s *Process) AddAuthenticator(authenticator Authenticator)
AddAuthenticator 注册认证器
func (*Process) SetAssociate ¶
func (s *Process) SetAssociate(associate AssociateCommand)
func (*Process) SetBind ¶
func (s *Process) SetBind(bind BindCommand)
func (*Process) SetConnect ¶
func (s *Process) SetConnect(connect ConnectCommand)
type Request ¶
type Request struct { Version Version // 协议版本 Cmd Cmd // 命令 TargetType AddrType // 目标地址类型 DstAddr []byte // 目标地址 DstPort uint16 // 目标端口 // contains filtered or unexported fields }
func (*Request) Decoder ¶
Decoder 解码器, 从缓冲区读取数据解析协议, RFC1928 https://datatracker.ietf.org/doc/html/rfc1928
type ResType ¶
type ResType byte
ResType 应答类型
const ( SuccessReply ResType = 0 // 成功 ServerFailure ResType = 1 // 服务器异常 RuleFailure ResType = 2 // 规则不允许 NetworkUnreachable ResType = 3 // 网络无法访问 HostUnreachable ResType = 4 // 主机无法访问 ConnectionRefused ResType = 5 // 连接被拒绝 TtlExpired ResType = 6 // TTL超时 CommandNotSupported ResType = 7 // 不支持的命令 AddrTypeNotSupported ResType = 8 // 不支持的地址类型 )