tgtest

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: MIT Imports: 25 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 {
	OnMessage(s Session, msgID int64, in *bin.Buffer) error
}

type HandlerFunc added in v0.12.0

type HandlerFunc func(s Session, msgID int64, in *bin.Buffer) error

HandlerFunc is functional adapter for Handler.OnMessage method.

func (HandlerFunc) OnMessage added in v0.12.0

func (h HandlerFunc) OnMessage(s Session, msgID int64, in *bin.Buffer) error

type Server

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

func NewServer

func NewServer(ctx context.Context, codec func() transport.Codec, h Handler) *Server

func NewUnstartedServer

func NewUnstartedServer(ctx context.Context, codec func() transport.Codec) *Server

func TestTransport added in v0.12.0

func TestTransport(s Suite, message string, codec func() transport.Codec) *Server

func (*Server) Addr added in v0.11.2

func (s *Server) Addr() net.Addr

func (*Server) Close

func (s *Server) Close()

func (*Server) ForceDisconnect added in v0.12.0

func (s *Server) ForceDisconnect(k Session)

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) SendAck added in v0.12.0

func (s *Server) SendAck(k Session, ids ...int64) error

func (*Server) SendConfig added in v0.12.0

func (s *Server) SendConfig(k Session, id int64) error

func (*Server) SendPong added in v0.12.0

func (s *Server) SendPong(k Session, msgID, pingID int64) error

func (*Server) SendResult added in v0.11.0

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

func (*Server) SendUpdates added in v0.12.0

func (s *Server) SendUpdates(k Session, updates ...tg.UpdateClass) error

func (*Server) SetHandler added in v0.11.0

func (s *Server) SetHandler(handler Handler)

func (*Server) SetHandlerFunc added in v0.12.0

func (s *Server) SetHandlerFunc(handler func(s Session, msgID int64, in *bin.Buffer) error)

func (*Server) Start

func (s *Server) Start()

type Session added in v0.11.0

type Session struct {
	SessionID int64
	crypto.AuthKeyWithID
}

type Suite added in v0.12.0

type Suite struct {
	testing.TB
	Ctx context.Context
	Log *zap.Logger
}

func NewSuite added in v0.12.0

func NewSuite(ctx context.Context, tb testing.TB, log *zap.Logger) Suite

type TB

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

Jump to

Keyboard shortcuts

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