mtproto

package
v0.1.80-dev.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mtproto is the panel half of the Telegram MTProto proxy plugin: the profile schema, validation, node-side inbound construction, credential issuing and the tg://proxy link.

Index

Constants

View Source
const (
	FallbackDecoy = "decoy"
	FallbackSite  = "site"
)

What the node does with a connection that is not a client: Fallback decoy answers with the node's own site, site forwards it to the chosen site, so a prober sees that site and its certificate.

View Source
const ID = "mtproto"

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeTLSNames

type FakeTLSNames struct {
	Kind   string `json:"kind"`
	Domain string `json:"domain"`
}

FakeTLSNames is where the name inside the Fake TLS handshake (the domain at the end of the ee secret) comes from. Kind own: the node's own host name, or the one set on the inbound; a node with only an IP address cannot use it. Kind site: Domain, a real site that is not this server's. A document that names a domain and no kind (read before the field existed) is site.

type NodeSettings

type NodeSettings struct {
	Domains  []string `json:"domains"`
	Fallback string   `json:"fallback"`
}

NodeSettings is the JSON the node engine receives in InboundSpec.Settings. Domains are the names a client may put in the Fake TLS handshake (one today); Fallback is FallbackDecoy for the node's own name and FallbackSite for another site, which the node reaches at Domains[0]:443. Field order is deterministic because the bytes feed the state hash.

type Protocol

type Protocol struct{}

func New

func New() *Protocol

func (*Protocol) BuildInbound

func (*Protocol) BuildInbound(in protocols.InboundInput) (plugin.InboundSpec, error)

func (*Protocol) Clients

func (*Protocol) Clients() []plugin.ClientSupport

func (*Protocol) DefaultSettings

func (*Protocol) DefaultSettings() (json.RawMessage, error)

func (*Protocol) DisplayName

func (*Protocol) DisplayName() string

func (*Protocol) Doctor

func (*Protocol) Doctor() []protocols.Check

func (*Protocol) Experimental

func (*Protocol) Experimental() bool

Experimental: the first Go port of the protocol, not proven in the field yet.

func (*Protocol) ID

func (*Protocol) ID() string

func (*Protocol) IssueCredential

func (*Protocol) IssueCredential(protocols.IssueInput) (protocols.Issued, error)

IssueCredential makes one MTProto key. Secret is the key in hex (what the panel stores sealed); the client link secret (ee + key + SNI in hex) is built from it when the link is rendered, because the SNI depends on the node. NodeData is what the node stores.

func (*Protocol) Render

Render returns one tg://proxy link, for FormatTelegramLink only. Every subscription format answers false: a tg:// line would be a bogus server in Happ and in every other app of the link.

func (*Protocol) SettingsSchema

func (*Protocol) SettingsSchema() []byte

func (*Protocol) Summary

func (p *Protocol) Summary(raw json.RawMessage) string

func (*Protocol) Validate

func (*Protocol) Validate(raw json.RawMessage) []protocols.FieldError

type Settings

type Settings struct {
	Port    int          `json:"port"`
	FakeTLS FakeTLSNames `json:"fake_tls"`
}

Settings is the merged profile settings document.

Jump to

Keyboard shortcuts

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