Documentation
¶
Index ¶
- func BuildFakeTLSSecret(rawSecret, domain string, maskingEnabled bool) string
- func BuildProxyLink(serverIP string, port int, secret string) string
- func BuildWebLink(serverIP string, port int, secret string) string
- func DomainToHex(domain string) string
- func GenerateSecret() (string, error)
- func ValidateSecretKey(key string) bool
- func WriteConfigTOML(cfg *TelemtConfig, path string) error
- type AccessConfig
- type CensorshipConfig
- type ConfigParams
- type GeneralConfig
- type LinksConfig
- type ModesConfig
- type SecretEntry
- type ServerConfig
- type TelegramConfig
- type TelemtConfig
- type TimeoutsConfig
- type UpstreamConfig
- type UpstreamEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFakeTLSSecret ¶
BuildFakeTLSSecret constructs the full FakeTLS secret for sharing. Format: ee + raw_secret + domain_hex (when masking enabled) Format: dd + raw_secret (when masking disabled)
func BuildProxyLink ¶
BuildProxyLink generates a tg://proxy link.
func BuildWebLink ¶
BuildWebLink generates a https://t.me proxy link.
func DomainToHex ¶
DomainToHex converts a domain string to its hex representation.
func GenerateSecret ¶
GenerateSecret creates a random 32-character hex secret.
func ValidateSecretKey ¶
ValidateSecretKey checks if a secret key is valid (32 hex chars).
func WriteConfigTOML ¶
func WriteConfigTOML(cfg *TelemtConfig, path string) error
WriteConfigTOML writes the TOML configuration to a file atomically.
Types ¶
type AccessConfig ¶
type AccessConfig struct {
ReplayCheckLen int `toml:"replay_check_len"`
ReplayWindowSecs int `toml:"replay_window_secs"`
IgnoreTimeSkew bool `toml:"ignore_time_skew"`
Users map[string]string `toml:"users"`
UserMaxTCPConns map[string]int `toml:"user_max_tcp_conns,omitempty"`
UserMaxUniqueIPs map[string]int `toml:"user_max_unique_ips,omitempty"`
UserDataQuota map[string]int64 `toml:"user_data_quota,omitempty"`
UserExpirations map[string]string `toml:"user_expirations,omitempty"`
}
type CensorshipConfig ¶
type CensorshipConfig struct {
TLSDomain string `toml:"tls_domain"`
UnknownSNIAction string `toml:"unknown_sni_action"`
Mask bool `toml:"mask"`
MaskPort int `toml:"mask_port"`
MaskHost string `toml:"mask_host,omitempty"`
MaskRelayMaxBytes int64 `toml:"mask_relay_max_bytes,omitempty"`
FakeCertLen int `toml:"fake_cert_len"`
}
type ConfigParams ¶
type ConfigParams struct {
Settings *model.Settings
Secrets []SecretEntry
Upstreams []UpstreamEntry
ExtraMetricsWhitelist []string // Additional IPs to allow in metrics_whitelist (e.g. Docker bridge IPs)
}
ConfigParams holds the parameters needed to generate a telemt config.
type GeneralConfig ¶
type GeneralConfig struct {
PreferIPv6 bool `toml:"prefer_ipv6"`
FastMode bool `toml:"fast_mode"`
UseMiddleProxy bool `toml:"use_middle_proxy"`
LogLevel string `toml:"log_level"`
AdTag string `toml:"ad_tag,omitempty"`
Modes ModesConfig `toml:"modes"`
Links LinksConfig `toml:"links"`
}
type LinksConfig ¶
type LinksConfig struct {
Show []string `toml:"show"`
}
type ModesConfig ¶
type SecretEntry ¶
type SecretEntry struct {
Label string
SecretKey string
Enabled bool
MaxConns int
MaxIPs int
QuotaBytes int64
ExpiresAt string
}
SecretEntry represents a secret for TOML generation.
type ServerConfig ¶
type ServerConfig struct {
Port int `toml:"port"`
ListenAddrIPv4 string `toml:"listen_addr_ipv4"`
ListenAddrIPv6 string `toml:"listen_addr_ipv6"`
ProxyProtocol bool `toml:"proxy_protocol"`
ProxyProtocolTrustedCIDRs []string `toml:"proxy_protocol_trusted_cidrs,omitempty"`
MetricsListen string `toml:"metrics_listen"`
MetricsWhitelist []string `toml:"metrics_whitelist"`
}
type TelegramConfig ¶ added in v0.0.10
type TelemtConfig ¶
type TelemtConfig struct {
General GeneralConfig `toml:"general"`
Server ServerConfig `toml:"server"`
Timeouts TimeoutsConfig `toml:"timeouts"`
Censorship CensorshipConfig `toml:"censorship"`
Access AccessConfig `toml:"access"`
Upstreams []UpstreamConfig `toml:"upstreams,omitempty"`
Telegram TelegramConfig `toml:"telegram,omitempty"`
}
TelemtConfig represents the full TOML configuration for the telemt engine.
func BuildConfig ¶
func BuildConfig(params *ConfigParams) *TelemtConfig
BuildConfig constructs the telemt TOML configuration.
type TimeoutsConfig ¶
type UpstreamConfig ¶
type UpstreamConfig struct {
Type string `toml:"type"`
Weight int `toml:"weight"`
Address string `toml:"address,omitempty"`
Username string `toml:"username,omitempty"`
Password string `toml:"password,omitempty"`
UserID string `toml:"user_id,omitempty"`
Interface string `toml:"interface,omitempty"`
}
type UpstreamEntry ¶
type UpstreamEntry struct {
Type model.UpstreamType
Address string
Username string
Password string
Weight int
Iface string
Enabled bool
}
UpstreamEntry represents an upstream for TOML generation.