server

package
v0.87.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

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 New

func New(c config.Config) *Server

func (*Server) Close

func (s *Server) Close()

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)

OnNewConnection /////////////////////////////////////////////////////////////////////////////////////////////

func (*Server) Ping

func (s *Server) Ping(ctx context.Context) (err error)

Ping ping the resource.

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

func (*Server) Serve

func (s *Server) Serve() error

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(c config.Config) *Session

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL