mtproto

package
v4.31.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderSize = 64
)

Variables

View Source
var File_proxy_mtproto_config_proto protoreflect.FileDescriptor

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"`
	// contains filtered or unexported fields
}

func (*Account) Descriptor deprecated

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

Deprecated: Use Account.ProtoReflect.Descriptor instead.

func (*Account) Equals

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

func (*Account) GetSecret

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

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) ProtoReflect

func (x *Account) ProtoReflect() protoreflect.Message

func (*Account) Reset

func (x *Account) Reset()

func (*Account) String

func (x *Account) String() string

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 {
	// contains filtered or unexported fields
}

func (*ClientConfig) Descriptor deprecated

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

Deprecated: Use ClientConfig.ProtoReflect.Descriptor instead.

func (*ClientConfig) ProtoMessage

func (*ClientConfig) ProtoMessage()

func (*ClientConfig) ProtoReflect

func (x *ClientConfig) ProtoReflect() protoreflect.Message

func (*ClientConfig) Reset

func (x *ClientConfig) Reset()

func (*ClientConfig) String

func (x *ClientConfig) String() string

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.Network

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"`
	// contains filtered or unexported fields
}

func (*ServerConfig) Descriptor deprecated

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

Deprecated: Use ServerConfig.ProtoReflect.Descriptor instead.

func (*ServerConfig) GetUser

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

func (*ServerConfig) ProtoMessage

func (*ServerConfig) ProtoMessage()

func (*ServerConfig) ProtoReflect

func (x *ServerConfig) ProtoReflect() protoreflect.Message

func (*ServerConfig) Reset

func (x *ServerConfig) Reset()

func (*ServerConfig) String

func (x *ServerConfig) String() string

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