Documentation ¶
Index ¶
- Constants
- Variables
- func NewAuthSessionManager() *authSessionManager
- type HandshakeStateCtx
- type Server
- func (s *Server) Close()
- func (s *Server) GatewaySendDataToGateway(ctx context.Context, in *gateway.TLGatewaySendDataToGateway) (reply *mtproto.Bool, err error)
- func (s *Server) GetAuthKey(authKeyId int64) *mtproto.AuthKeyInfo
- func (s *Server) GetConnByConnID(id uint64) *net2.TcpConnection
- func (s *Server) OnConnectionClosed(conn *net2.TcpConnection)
- func (s *Server) OnConnectionDataArrived(conn *net2.TcpConnection, msg interface{}) error
- func (s *Server) OnNewConnection(conn *net2.TcpConnection)
- func (s *Server) Ping(ctx context.Context) (err error)
- func (s *Server) PutAuthKey(keyInfo *mtproto.AuthKeyInfo)
- func (s *Server) SendToClient(conn *net2.TcpConnection, authKey *authKeyUtil, b []byte) error
- func (s *Server) Serve() error
- type Session
Constants ¶
View Source
const ( STATE_ERROR = 0x0000 STATE_CONNECTED2 = 0x0100 STATE_HANDSHAKE = 0x0200 STATE_pq = 0x0201 STATE_pq_res = 0x0202 STATE_pq_ack = 0x0203 STATE_DH_params = 0x0204 STATE_DH_params_res = 0x0205 STATE_DH_params_res_fail = 0x0206 STATE_DH_params_ack = 0x0207 STATE_dh_gen = 0x0208 STATE_dh_gen_res = 0x0209 STATE_dh_gen_res_retry = 0x020a STATE_dh_gen_res_fail = 0x020b STATE_dh_gen_ack = 0x020c STATE_AUTH_KEY = 0x0300 )
View Source
const ( RES_STATE_NONE = 0x00 RES_STATE_OK = 0x01 RES_STATE_ERROR = 0x02 )
View Source
const (
SHA_DIGEST_LENGTH = 20
)
Variables ¶
View Source
var (
ErrSessionNotFound = errors.New("not found session")
)
Functions ¶
func NewAuthSessionManager ¶
func NewAuthSessionManager() *authSessionManager
Types ¶
type HandshakeStateCtx ¶ added in v0.86.0
type HandshakeStateCtx struct { State int32 `json:"state,omitempty"` ResState int32 `json:"res_state,omitempty"` Nonce []byte `json:"nonce,omitempty"` ServerNonce []byte `json:"server_nonce,omitempty"` NewNonce []byte `json:"new_nonce,omitempty"` A []byte `json:"a,omitempty"` P []byte `json:"p,omitempty"` ExpiresIn int32 `json:"expires_in,omitempty"` // contains filtered or unexported fields }
func (*HandshakeStateCtx) DebugString ¶ added in v0.86.0
func (m *HandshakeStateCtx) DebugString() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GatewaySendDataToGateway ¶
func (s *Server) GatewaySendDataToGateway(ctx context.Context, in *gateway.TLGatewaySendDataToGateway) (reply *mtproto.Bool, err error)
GatewaySendDataToGateway gateway.sendDataToGateway auth_key_id:long session_id:long payload:bytes = Bool;
func (*Server) GetAuthKey ¶
func (s *Server) GetAuthKey(authKeyId int64) *mtproto.AuthKeyInfo
func (*Server) GetConnByConnID ¶ added in v0.86.0
func (s *Server) GetConnByConnID(id uint64) *net2.TcpConnection
func (*Server) OnConnectionClosed ¶ added in v0.86.0
func (s *Server) OnConnectionClosed(conn *net2.TcpConnection)
func (*Server) OnConnectionDataArrived ¶ added in v0.86.0
func (s *Server) OnConnectionDataArrived(conn *net2.TcpConnection, msg interface{}) error
func (*Server) OnNewConnection ¶ added in v0.86.0
func (s *Server) OnNewConnection(conn *net2.TcpConnection)
/////////////////////////////////////////////////////////////////////////////////////////////
func (*Server) PutAuthKey ¶
func (s *Server) PutAuthKey(keyInfo *mtproto.AuthKeyInfo)
func (*Server) SendToClient ¶ added in v0.86.0
func (s *Server) SendToClient(conn *net2.TcpConnection, authKey *authKeyUtil, b []byte) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.