Documentation ¶
Overview ¶
NTCP[Network transmission control protocol] Support tcp/udp/tcp bind/udp bind/mgr/ping
Index ¶
- Constants
- Variables
- func Addr2Byte(addrSpec *AddrSpec) (uint8, []byte, error)
- func GetATyp(aTyp uint8) string
- func GetCmd(cmd uint8) string
- func GetProtocol(pro uint8) string
- func LegalProxyMode(cmd uint8) bool
- type AES128Context
- type AddrSpec
- type AuthContext
- type Authenticator
- type BindConn
- type BindDatagram
- type ChaCha20Context
- type ChaCha20Key
- type CredentialStore
- type CryptoStore
- type CryptoSupport
- type CryptorContext
- type Datagram
- type DatagramS
- type Logger
- type Mem
- type MemAllocation
- type MemMgr
- type NoAuthenticator
- type NoneContext
- type NtcpDial
- type NtcpListen
- type NtcpLogger
- type NtcpNewConn
- type NtcpNewPeer
- type NtcpSession
- func (ns *NtcpSession) Bind(network string, area uint8) (BindConn, error)
- func (ns *NtcpSession) Close() error
- func (ns *NtcpSession) Connect(network, dstAddr string, area uint8) (net.Conn, error)
- func (ns *NtcpSession) ConnectWithBind(network, dstAddr string, area uint8) (net.Conn, error)
- func (ns *NtcpSession) CryptoSyncVersion() uint8
- func (ns *NtcpSession) Cryptoer() CryptorContext
- func (ns *NtcpSession) Dial(ctx context.Context, addr string) error
- func (ns *NtcpSession) GetBindHost() string
- func (ns *NtcpSession) IsDead() bool
- func (ns *NtcpSession) Logger() Logger
- func (ns *NtcpSession) SessionUid() uint32
- type NtcpSessionDead
- type NtcpTcp
- func (nc *NtcpTcp) Close() error
- func (nc *NtcpTcp) Dial(ctx context.Context, proxyAddr *AddrSpec, dstAddr *AddrSpec, ntcpDial NtcpDial) error
- func (nc *NtcpTcp) LocalAddr() net.Addr
- func (nc *NtcpTcp) Read(b []byte) (n int, err error)
- func (nc *NtcpTcp) RemoteAddr() net.Addr
- func (nc *NtcpTcp) SetDeadline(t time.Time) error
- func (nc *NtcpTcp) SetReadDeadline(t time.Time) error
- func (nc *NtcpTcp) SetWriteDeadline(t time.Time) error
- func (nc *NtcpTcp) Write(b []byte) (n int, err error)
- type NtcpTdp
- func (nc *NtcpTdp) Close() error
- func (nc *NtcpTdp) Dial(ctx context.Context, proxyAddr *AddrSpec, ntcpDial NtcpDial) error
- func (nc *NtcpTdp) LocalAddr() net.Addr
- func (nc *NtcpTdp) Read(b []byte) (n int, err error)
- func (nc *NtcpTdp) RemoteAddr() net.Addr
- func (nc *NtcpTdp) SetDeadline(t time.Time) error
- func (nc *NtcpTdp) SetReadDeadline(t time.Time) error
- func (nc *NtcpTdp) SetWriteDeadline(t time.Time) error
- func (nc *NtcpTdp) Write(b []byte) (n int, err error)
- type NtcpUdp
- func NewNtcpUdp(session Session, dstAddr *AddrSpec, area uint8) *NtcpUdp
- func NewNtcpUdpOverTdp(session Session, mem MemAllocation, dstAddr *AddrSpec, area uint8) (*NtcpUdp, error)
- func NewNtcpUdpOverTdpWithBind(session Session, tdpConn *NtcpTdp, mem MemAllocation, area uint8) (*NtcpUdp, error)
- func NewNtcpUdpWithBind(session Session, dstAddr *AddrSpec, area uint8) *NtcpUdp
- func NewNtcpUdpWithConn(session Session, closeCB closeOneFn, conn *net.UDPConn, from *net.UDPAddr, ...) *NtcpUdp
- func NewNtcpUdpWithTdpConn(session Session, tdpConn *NtcpTdp, mem MemAllocation, dstAddr *AddrSpec, ...) (*NtcpUdp, error)
- func (nc *NtcpUdp) Close() error
- func (nc *NtcpUdp) Dial(ctx context.Context, proxyAddr *AddrSpec, ntcpDial NtcpDial) error
- func (nc *NtcpUdp) DialTdp(ctx context.Context, proxyAddr *AddrSpec) error
- func (nc *NtcpUdp) LocalAddr() net.Addr
- func (nc *NtcpUdp) Read(b []byte) (n int, err error)
- func (nc *NtcpUdp) RemoteAddr() net.Addr
- func (nc *NtcpUdp) SetDeadline(t time.Time) error
- func (nc *NtcpUdp) SetReadDeadline(t time.Time) error
- func (nc *NtcpUdp) SetWriteDeadline(t time.Time) error
- func (nc *NtcpUdp) Write(b []byte) (n int, err error)
- type NtcpUdpBind
- func (nc *NtcpUdpBind) Close() error
- func (nc *NtcpUdpBind) Dial(ctx context.Context, proxyAddr *AddrSpec, ntcpDial NtcpDial) error
- func (nc *NtcpUdpBind) DialTdp(ctx context.Context, proxyAddr *AddrSpec) error
- func (nc *NtcpUdpBind) LocalAddr() net.Addr
- func (nc *NtcpUdpBind) ProxyBindAddr() (string, error)
- func (nc *NtcpUdpBind) Read(b []byte) (n int, err error)
- func (nc *NtcpUdpBind) ReadFrom(b []byte) (int, net.Addr, error)
- func (nc *NtcpUdpBind) RemoteAddr() net.Addr
- func (nc *NtcpUdpBind) SetDeadline(t time.Time) error
- func (nc *NtcpUdpBind) SetReadDeadline(t time.Time) error
- func (nc *NtcpUdpBind) SetWriteDeadline(t time.Time) error
- func (nc *NtcpUdpBind) Write(b []byte) (n int, err error)
- func (nc *NtcpUdpBind) WriteTo(b []byte, addr net.Addr) (int, error)
- type ProxyHeader
- type ProxyServer
- type ProxyUdp
- type Request
- type Server
- type ServerConfig
- type Session
- type SessionConfig
- type StaticCredentials
- type TdpData
- type TeaContext
- type TeaKey
- type UserPassAuthenticator
Constants ¶
const ( NoAuth = uint8(0) UserPassAuth = uint8(1) UserAuthVersion = uint8(1) AuthSuccess = uint8(0) AuthFailure = uint8(1) NoAcceptable = uint8(255) )
const ( FATAL = "fatal" ERROR = "error" WARN = "warn" INFO = "info" DEBUG = "debug" )
const ( NtcpVersion = uint8(0x01) NtcpHeaderLen = 16 // 命令 ServerAddrCmd = uint8(0x01) //获取服务端绑定地址 CryptoCmd = uint8(0x02) //密钥交换 HeartBeatCmd = uint8(0x03) //心跳 ConnectCmd = uint8(0x04) //发起代理连接 BindCmd = uint8(0x05) //发起代理绑定 BindStatusCmd = uint8(0x06) //Bind响应 AcceptCmd = uint8(0x07) //代理接受TCP请求 RecvFromCmd = uint8(0x08) //bind代理接收UDP数据 SendToCmd = uint8(0x09) //bind代理发送UDP数据 PingCmd = uint8(0x20) //ping MtrCmd = uint8(0x21) //mtr // 协议 ProTcp = uint8(0x01) // tcp ProUdp = uint8(0x02) // udp ProIcmp = uint8(0x03) // icmp NtcpHeaderSize = 16 )
const ( TimeoutSecond = time.Second * 30 UpdateCryptoTime = time.Minute * 5 )
const ( UdpListenerReadBufferSize = 64 * 1024 UdpListenerWriteBufferSize = 64 * 1024 UdpReadBufferSize = 32 * 1024 UdpWriteBufferSize = 32 * 1024 TcpReadBufferSize = 32 * 1024 TcpWriteBufferSize = 32 * 1024 PacketBufSize = 1024 * 16 MemPoolNodeSize = 1600 )
const ( TdpHeaderLen = 12 TdpVersion = 0 )
const (
NotUseAddr = "127.0.0.1:1"
)
Variables ¶
var ( UserAuthFailed = fmt.Errorf("User Authentication Failed") NoSupportedAuth = fmt.Errorf("No Supported Authentication") )
var ( MaxConnCount = uint32(102400) // NTCP并发连接数 BitValue01 = byte(0x01) )
Functions ¶
func GetProtocol ¶
func LegalProxyMode ¶
Types ¶
type AES128Context ¶
type AES128Context struct { // 加密方法 Method crypto.CryptoType // 加密秘钥版本 秘钥会定时更新 表示当前 Keys 索引 Version uint8 // Keys 数组长度由 version最大值决定 Keys [keyArrayLen][]byte // contains filtered or unexported fields }
AES128
func NewAES128Context ¶
func NewAES128Context(cryptoCode crypto.CryptoType) *AES128Context
func (*AES128Context) GenerateKey ¶
func (aes128 *AES128Context) GenerateKey()
func (*AES128Context) GetCode ¶
func (aes128 *AES128Context) GetCode() crypto.CryptoType
func (*AES128Context) GetVersion ¶
func (aes128 *AES128Context) GetVersion() uint8
type AuthContext ¶
type Authenticator ¶
type BindConn ¶
type BindConn interface { Read(b []byte) (n int, err error) Write(b []byte) (n int, err error) Close() error LocalAddr() net.Addr RemoteAddr() net.Addr SetDeadline(t time.Time) error SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error // 获取代理服务bind地址 ProxyBindAddr() (string, error) // 读取数据 ReadFrom(b []byte) (int, net.Addr, error) // 发送数据 WriteTo(b []byte, addr net.Addr) (int, error) }
type BindDatagram ¶
type BindDatagram struct { // 实际要传输的数据 Data []byte // contains filtered or unexported fields }
func NewBindDatagram ¶
func NewBindDatagram(ctx context.Context, cmd, aTyp byte, host, port, data []byte) *BindDatagram
请看协议头说明
func NewBindDatagramFromByte ¶
func NewBindDatagramFromByte(ctx context.Context, bs []byte) (*BindDatagram, error)
请看协议头说明 * @param bs 切片会被引用,请注意使用
func NewBindDatagramFromIO ¶
请看协议头说明 tcp才会调用
func (*BindDatagram) Address ¶
func (d *BindDatagram) Address() string
func (*BindDatagram) Cmd ¶
func (d *BindDatagram) Cmd() byte
func (*BindDatagram) Host ¶
func (d *BindDatagram) Host() string
func (*BindDatagram) Port ¶
func (d *BindDatagram) Port() int
type ChaCha20Context ¶
type ChaCha20Context struct { // 加密方法 Method crypto.CryptoType // 加密秘钥版本 秘钥会定时更新 表示当前 Keys 索引 Version uint8 // Keys 数组长度由 version最大值决定 Keys [keyArrayLen]*ChaCha20Key // contains filtered or unexported fields }
func NewChaCha20Context ¶
func NewChaCha20Context(cryptoCode crypto.CryptoType) *ChaCha20Context
func (*ChaCha20Context) GenerateKey ¶
func (chacha *ChaCha20Context) GenerateKey()
func (*ChaCha20Context) GetCode ¶
func (chacha *ChaCha20Context) GetCode() crypto.CryptoType
func (*ChaCha20Context) GetKey ¶
func (chacha *ChaCha20Context) GetKey(version uint8) ([][]byte, bool)
func (*ChaCha20Context) GetVersion ¶
func (chacha *ChaCha20Context) GetVersion() uint8
type CredentialStore ¶
CredentialStore 用于支持用户密码认证
type CryptoStore ¶
type CryptoStore interface { SetMethod(method crypto.CryptoType) Valid(method crypto.CryptoType) bool GetMethods() []crypto.CryptoType }
设置支持加密算法
type CryptoSupport ¶
type CryptoSupport map[crypto.CryptoType]struct{}
func (CryptoSupport) GetMethods ¶
func (c CryptoSupport) GetMethods() []crypto.CryptoType
func (CryptoSupport) SetMethod ¶
func (c CryptoSupport) SetMethod(method crypto.CryptoType)
func (CryptoSupport) Valid ¶
func (c CryptoSupport) Valid(method crypto.CryptoType) bool
type CryptorContext ¶
type CryptorContext interface { // 生成秘钥 GenerateKey() // 获取对应版本的秘钥 GetKey(version uint8) ([][]byte, bool) // 获取算法code GetCode() crypto.CryptoType // 获取秘钥版本 GetVersion() uint8 // 客户端使用 SetKey(version uint8, key [][]byte) bool }
func GetCryptoContext ¶
func GetCryptoContext(cryptoCode crypto.CryptoType) CryptorContext
type Datagram ¶
type Datagram struct { // 实际要传输的数据 Data []byte // contains filtered or unexported fields }
func NewDatagram ¶
func NewDatagram(ctx context.Context, cryptoVer, cmd, protocol, aTyp, area byte, connId uint16, uid uint32, host, port, data []byte) *Datagram
请看协议头说明
func NewDatagramFromByte ¶
请看协议头说明 * @param bs 切片会被引用,请注意使用
func ReadDatagramHeaderFromIO ¶
请看协议头说明 tcp才会调用
func (*Datagram) ConnectionId ¶
type DatagramS ¶
type DatagramS struct { // 实际要传输的数据 Data []byte // contains filtered or unexported fields }
func NewDatagramS ¶
请看协议头说明
func NewDatagramSFromByte ¶
请看协议头说明 * @param bs 切片会被引用,请注意使用
type MemAllocation ¶
type MemAllocation interface { Alloc(ctx context.Context, size int) []byte Free(ctx context.Context, bs []byte) }
mem allocation by ctinkong
type MemMgr ¶
type MemMgr interface {
Create(ctx context.Context) MemAllocation
}
mem mgr by ctinkong
type NoAuthenticator ¶
type NoAuthenticator struct{}
无认证
func (NoAuthenticator) Authenticate ¶
func (a NoAuthenticator) Authenticate(reader io.Reader, writer io.Writer) (*AuthContext, error)
func (NoAuthenticator) GetCode ¶
func (a NoAuthenticator) GetCode() uint8
type NoneContext ¶
type NoneContext struct { // 加密方法 Method crypto.CryptoType // 加密秘钥版本 秘钥会定时更新 表示当前 Keys 索引 Version uint8 // Keys 数组长度由 version最大值决定 Keys [keyArrayLen][]byte // contains filtered or unexported fields }
None
func NewNoneContext ¶
func NewNoneContext(cryptoCode crypto.CryptoType) *NoneContext
func (*NoneContext) GenerateKey ¶
func (none *NoneContext) GenerateKey()
func (*NoneContext) GetCode ¶
func (none *NoneContext) GetCode() crypto.CryptoType
func (*NoneContext) GetVersion ¶
func (none *NoneContext) GetVersion() uint8
type NtcpLogger ¶
type NtcpLogger struct { }
type NtcpNewConn ¶
type NtcpNewConn func(session Session, proxyHeader ProxyHeader) (net.Conn, error)
新连接来了
type NtcpSession ¶
type NtcpSession struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(conf *SessionConfig, cb NtcpSessionDead) *NtcpSession
*NewSession 创建会话,客户端使用 *@param conf 会话配置
func (*NtcpSession) Bind ¶
func (ns *NtcpSession) Bind(network string, area uint8) (BindConn, error)
* Bind 发起bind代理连接 * @param network 网络类型,目前支持udp * @param area 选区 如果没有填 0 即可
func (*NtcpSession) Close ¶
func (ns *NtcpSession) Close() error
func (*NtcpSession) Connect ¶
* Connect 发起connect代理连接 * @param network 网络类型,目前支持tcp、udp * @param dstAddr 目标地址,支持ip:port、domain:port * @param area 选区 如果没有填 0 即可
func (*NtcpSession) ConnectWithBind ¶
* ConnectWithBind 发起代理连接,中间节点调用 * @param network 网络类型,目前支持tcp、udp * @param dstAddr 目标地址,支持ip:port、domain:port * @param area 选区 如果没有填 0 即可
func (*NtcpSession) CryptoSyncVersion ¶
func (ns *NtcpSession) CryptoSyncVersion() uint8
服务端与客户端同步的加密版本号
type NtcpTcp ¶
type NtcpTcp struct {
// contains filtered or unexported fields
}
func (*NtcpTcp) Dial ¶
func (nc *NtcpTcp) Dial(ctx context.Context, proxyAddr *AddrSpec, dstAddr *AddrSpec, ntcpDial NtcpDial) error
客户端使用
* Dial 发起代理连接 * @param proxyAddr 代理服务器地址 * @param dstAddr 目标地址 * @param ntcpDial dial回调函数
func (*NtcpTcp) RemoteAddr ¶
type NtcpTdp ¶
type NtcpTdp struct {
// contains filtered or unexported fields
}
func (*NtcpTdp) Dial ¶
客户端使用
* Dial 发起代理连接 * @param proxyAddr 代理服务器地址 * @param dstAddr 目标地址 * @param ntcpDial dial回调函数
func (*NtcpTdp) RemoteAddr ¶
type NtcpUdp ¶
type NtcpUdp struct {
// contains filtered or unexported fields
}
func NewNtcpUdp ¶
* NewNtcpUdp 客户端创建udp * @param session 会话 * @param area 选区ID
func NewNtcpUdpOverTdp ¶
func NewNtcpUdpOverTdp(session Session, mem MemAllocation, dstAddr *AddrSpec, area uint8) (*NtcpUdp, error)
* NewNtcpUdpWithTdpConn 客户端新的connect请求,基于tdp基础上,只会在客户端使用 * @param session 会话 * @param mem 内存器 * @param area 选取ID
func NewNtcpUdpOverTdpWithBind ¶
func NewNtcpUdpOverTdpWithBind(session Session, tdpConn *NtcpTdp, mem MemAllocation, area uint8) (*NtcpUdp, error)
* NewNtcpUdpWithTdpConn 第一跳通过tdp接收到的BindCmd请求 * @param session 会话 * @param tdpConn tdp连接 * @param mem 内存管理器 * @param area 选取ID
func NewNtcpUdpWithBind ¶
* NewNtcpUdpWithBind 中间代理bind客户端使用,注意是代理服务器上的客户端角色 * @param session 会话 * @param area 选区ID
func NewNtcpUdpWithConn ¶
func NewNtcpUdpWithConn(session Session, closeCB closeOneFn, conn *net.UDPConn, from *net.UDPAddr, mem MemAllocation, cmd uint8, connId uint16, area uint8) *NtcpUdp
* NewNtcpUdpWithConn 服务端收到新请求,创建udp * @param session 会话 * @param conn 服务端监听连接 * @param from 连接来源 * @param cmd cmd,可能是 connect/bind * @param connId 连接ID * @param area 选取ID
func NewNtcpUdpWithTdpConn ¶
func NewNtcpUdpWithTdpConn(session Session, tdpConn *NtcpTdp, mem MemAllocation, dstAddr *AddrSpec, area uint8) (*NtcpUdp, error)
* NewNtcpUdpWithTdpConn 服务端收到客户端新的connect请求,基于tdp基础上,只会在上车节点使用 * @param session 会话 * @param connId 连接ID * @param area 选取ID
func (*NtcpUdp) RemoteAddr ¶
type NtcpUdpBind ¶
type NtcpUdpBind struct {
// contains filtered or unexported fields
}
* NtcpUdpBind bing模式的普通udp,只有在代理的链路的客户端与下车节点使用,而且仅作为dst连接 ,中间节点传输依然使用 NtcpUdp
func NewNtcpUdpBind ¶
func NewNtcpUdpBind(session Session, area uint8) *NtcpUdpBind
* NewNtcpUdpBind 客户端创建udp * @param session 会话 * @param area 选区ID
func NewNtcpUdpBindOverTdp ¶
func NewNtcpUdpBindOverTdp(session Session, mem MemAllocation, area uint8) (*NtcpUdpBind, error)
* NewNtcpUdpBindOverTdp 服务端收到客户端新的bind请求,基于tdp基础上,只会在中间节点使用 * @param session 会话 * @param connId 连接ID * @param area 选取ID
func NewNtcpUdpBindWithConn ¶
func NewNtcpUdpBindWithConn(session Session, mem MemAllocation, connId uint16, area uint8) (*NtcpUdpBind, error)
* NewNtcpUdpBindWithConn 服务端收到客户端新的bind请求,创建udp * @param session 会话 * @param connId 连接ID * @param area 选取ID
func (*NtcpUdpBind) Close ¶
func (nc *NtcpUdpBind) Close() error
func (*NtcpUdpBind) DialTdp ¶
func (nc *NtcpUdpBind) DialTdp(ctx context.Context, proxyAddr *AddrSpec) error
客户端使用
func (*NtcpUdpBind) LocalAddr ¶
func (nc *NtcpUdpBind) LocalAddr() net.Addr
func (*NtcpUdpBind) ProxyBindAddr ¶
func (nc *NtcpUdpBind) ProxyBindAddr() (string, error)
客户端使用 获取代理服务bind地址
func (*NtcpUdpBind) Read ¶
func (nc *NtcpUdpBind) Read(b []byte) (n int, err error)
服务端下车节点使用,中间节点传输依然使用 NtcpUdp
func (*NtcpUdpBind) RemoteAddr ¶
func (nc *NtcpUdpBind) RemoteAddr() net.Addr
func (*NtcpUdpBind) SetDeadline ¶
func (nc *NtcpUdpBind) SetDeadline(t time.Time) error
func (*NtcpUdpBind) SetReadDeadline ¶
func (nc *NtcpUdpBind) SetReadDeadline(t time.Time) error
func (*NtcpUdpBind) SetWriteDeadline ¶
func (nc *NtcpUdpBind) SetWriteDeadline(t time.Time) error
type ProxyHeader ¶
type ProxyServer ¶
type ProxyServer struct {
// contains filtered or unexported fields
}
func (*ProxyServer) Close ¶
func (p *ProxyServer) Close() error
type Request ¶
type Request struct { Config *ServerConfig AuthContext *AuthContext Version uint8 // 协议版本 ClientCryptoVersion uint8 // 客户端加密版本 Uid uint32 // 连接唯一标识 CryptorContext CryptorContext // 秘钥上下文 Conn net.Conn // io Log Logger // 日志 // contains filtered or unexported fields }
请求
func (*Request) UpdateSyncVersion ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
ntcp 服务
func NewServer ¶
func NewServer(conf *ServerConfig, ntcpNewConn NtcpNewConn, ntcpNewPeer NtcpNewPeer) (*Server, error)
创建 ntcp 服务
*NewServer 创建ntcp服务 *@param conf 服务配置 *@param ntcpNewConn 收到新的代理请求,回调创建连接 *@param ntcpNewPeer 新的代理匹配成功了 该回调函数处理代理数据转发逻辑,回调函数不需要Close连接
type ServerConfig ¶
type ServerConfig struct { // 使用者可提供自定义认证方式 // 如果 AuthMethods 不为空 则会忽略 Credentials AuthMethods []Authenticator // AuthMethods 为空:如果 Credentials 不为空,则支持用户密码认证,否则不需要认证 // AuthMethods 不为空: 忽略 Credentials Credentials CredentialStore // 自定义存放支持加密算法 CryptoStores CryptoStore // BindHost 用于TCP/UDP代理绑定host(域名或者IP),可被客户端连接 BindHost string // 新连接 Dial NtcpDial // 新绑定请求,客户端使用bind命令是需要调用上层业务 Disten NtcpListen // 日志 Log Logger // 内存分配器 MemMgr MemMgr }
服务器配置
func (*ServerConfig) GetBindHost ¶
func (s *ServerConfig) GetBindHost() string
type SessionConfig ¶
type SessionConfig struct { Credentials CredentialStore // 保存用户密码 CryptoMethod crypto.CryptoType // 加密方式 Log Logger // 日志 Dial NtcpDial // 可自定义连接函数 }
客户端配置
type StaticCredentials ¶
StaticCredentials 声明map类型
func (StaticCredentials) Valid ¶
func (s StaticCredentials) Valid(user, password string) bool
type TdpData ¶
type TdpData struct { // 实际要传输的数据 Data []byte // contains filtered or unexported fields }
type TeaContext ¶
type TeaContext struct { // 加密方法 Method crypto.CryptoType // 加密秘钥版本 秘钥会定时更新 表示当前 Keys 索引 Version uint8 // Keys 数组长度由 version最大值决定 Keys [keyArrayLen]*TeaKey // contains filtered or unexported fields }
func NewTeaContext ¶
func NewTeaContext(cryptoCode crypto.CryptoType) *TeaContext
func (*TeaContext) GenerateKey ¶
func (tea *TeaContext) GenerateKey()
func (*TeaContext) GetCode ¶
func (tea *TeaContext) GetCode() crypto.CryptoType
func (*TeaContext) GetVersion ¶
func (tea *TeaContext) GetVersion() uint8
type UserPassAuthenticator ¶
type UserPassAuthenticator struct {
Credentials CredentialStore
}
用户名密码认证
func (UserPassAuthenticator) Authenticate ¶
func (a UserPassAuthenticator) Authenticate(reader io.Reader, writer io.Writer) (*AuthContext, error)
func (UserPassAuthenticator) GetCode ¶
func (a UserPassAuthenticator) GetCode() uint8