mtproto

package
v4.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderSize = 64
)

Variables

This section is empty.

Functions

func ContextWithSessionContext

func ContextWithSessionContext(ctx context.Context, c SessionContext) context.Context

func Inverse

func Inverse(b []byte) []byte

Inverse returns a new byte array. It is a sequence of bytes when the input is read from end to beginning.Inverse Visible for testing only.

Types

type Account

type Account struct {
	Secret               []byte   `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Account) Descriptor

func (*Account) Descriptor() ([]byte, []int)

func (*Account) Equals

func (a *Account) Equals(another protocol.Account) bool

func (*Account) GetSecret

func (m *Account) GetSecret() []byte

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) Reset

func (m *Account) Reset()

func (*Account) String

func (m *Account) String() string

func (*Account) XXX_DiscardUnknown

func (m *Account) XXX_DiscardUnknown()

func (*Account) XXX_Marshal

func (m *Account) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Account) XXX_Merge

func (m *Account) XXX_Merge(src proto.Message)

func (*Account) XXX_Size

func (m *Account) XXX_Size() int

func (*Account) XXX_Unmarshal

func (m *Account) XXX_Unmarshal(b []byte) error

type Authentication

type Authentication struct {
	Header        [HeaderSize]byte
	DecodingKey   [32]byte
	EncodingKey   [32]byte
	DecodingNonce [16]byte
	EncodingNonce [16]byte
}

func NewAuthentication

func NewAuthentication(sc SessionContext) *Authentication

func ReadAuthentication

func ReadAuthentication(reader io.Reader) (*Authentication, error)

func (*Authentication) ApplySecret

func (a *Authentication) ApplySecret(b []byte)

func (*Authentication) ConnectionType

func (a *Authentication) ConnectionType() [4]byte

func (*Authentication) DataCenterID

func (a *Authentication) DataCenterID() uint16

type Client

type Client struct {
}

func NewClient

func NewClient(ctx context.Context, config *ClientConfig) (*Client, error)

func (*Client) Process

func (c *Client) Process(ctx context.Context, link *transport.Link, dialer internet.Dialer) error

type ClientConfig

type ClientConfig struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ClientConfig) Descriptor

func (*ClientConfig) Descriptor() ([]byte, []int)

func (*ClientConfig) ProtoMessage

func (*ClientConfig) ProtoMessage()

func (*ClientConfig) Reset

func (m *ClientConfig) Reset()

func (*ClientConfig) String

func (m *ClientConfig) String() string

func (*ClientConfig) XXX_DiscardUnknown

func (m *ClientConfig) XXX_DiscardUnknown()

func (*ClientConfig) XXX_Marshal

func (m *ClientConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClientConfig) XXX_Merge

func (m *ClientConfig) XXX_Merge(src proto.Message)

func (*ClientConfig) XXX_Size

func (m *ClientConfig) XXX_Size() int

func (*ClientConfig) XXX_Unmarshal

func (m *ClientConfig) XXX_Unmarshal(b []byte) error

type Server

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

func NewServer

func NewServer(ctx context.Context, config *ServerConfig) (*Server, error)

func (*Server) Network

func (s *Server) Network() net.NetworkList

func (*Server) Process

func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher routing.Dispatcher) error

type ServerConfig

type ServerConfig struct {
	// User is a list of users that allowed to connect to this inbound.
	// Although this is a repeated field, only the first user is effective for now.
	User                 []*protocol.User `protobuf:"bytes,1,rep,name=user,proto3" json:"user,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*ServerConfig) Descriptor

func (*ServerConfig) Descriptor() ([]byte, []int)

func (*ServerConfig) GetUser

func (m *ServerConfig) GetUser() []*protocol.User

func (*ServerConfig) ProtoMessage

func (*ServerConfig) ProtoMessage()

func (*ServerConfig) Reset

func (m *ServerConfig) Reset()

func (*ServerConfig) String

func (m *ServerConfig) String() string

func (*ServerConfig) XXX_DiscardUnknown

func (m *ServerConfig) XXX_DiscardUnknown()

func (*ServerConfig) XXX_Marshal

func (m *ServerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ServerConfig) XXX_Merge

func (m *ServerConfig) XXX_Merge(src proto.Message)

func (*ServerConfig) XXX_Size

func (m *ServerConfig) XXX_Size() int

func (*ServerConfig) XXX_Unmarshal

func (m *ServerConfig) XXX_Unmarshal(b []byte) error

type SessionContext

type SessionContext struct {
	ConnectionType [4]byte
	DataCenterID   uint16
}

func DefaultSessionContext

func DefaultSessionContext() SessionContext

func SessionContextFromContext

func SessionContextFromContext(ctx context.Context) SessionContext

Jump to

Keyboard shortcuts

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