tgtest

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package tgtest provides test Telegram server for end-to-end test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler added in v0.11.0

type Handler interface {
	OnNewClient(s Session) error
	OnMessage(s Session, msgID int64, in *bin.Buffer) error
}

type Server

type Server struct {
	Listener net.Listener
	// contains filtered or unexported fields
}

func NewServer

func NewServer(tb TB, h Handler) *Server

func NewUnstartedServer

func NewUnstartedServer(tb TB) *Server

func (*Server) Close

func (s *Server) Close()

func (*Server) Key

func (s *Server) Key() *rsa.PublicKey

func (*Server) Send added in v0.11.0

func (s *Server) Send(k Session, encoder bin.Encoder) error

func (*Server) SendResult added in v0.11.0

func (s *Server) SendResult(k Session, id int64, msg bin.Encoder) error

func (*Server) SetHandler added in v0.11.0

func (s *Server) SetHandler(handler Handler)

func (*Server) Start

func (s *Server) Start()

type Session added in v0.11.0

type Session struct {
	Key       crypto.AuthKey
	SessionID int64
}

type TB

type TB interface {
	Log(args ...interface{})
	Logf(format string, args ...interface{})
}

Jump to

Keyboard shortcuts

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