Documentation
¶
Overview ¶
Package protocol defines the master/agent WebSocket v1 contract.
Index ¶
- Constants
- Variables
- func Clone[T any](value T) T
- func Decode(b []byte, out any) error
- func Schema(value any) map[string]any
- func Schemas() map[string]any
- func UserEmail(u User, tag string) string
- func ValidName(s string) bool
- func ValidateUsers(users []User) error
- type Certificate
- type Config
- type DDNSJob
- type DNSPolicy
- type FirewallPolicy
- type Forward
- type IPBlock
- type IPControl
- type Message
- type PortRange
- type Provider
- type TelemetryPolicy
- type TorrentPolicy
- type UpdatePolicy
- type User
- type UserControl
- type UserControls
- type UsersDelta
- type UsersSync
Constants ¶
View Source
const MaxFrameBytes = 16 << 20
View Source
const Version = 1
Variables ¶
View Source
var CommandNames = []string{"connections.list", "connections.close", "users.active_ips", "ips.control", "metrics.get", "jobs.list", "firewall.status", "firewall.confirm", "firewall.apply", "speedtest", "update.check", "update.install", "update.rollback", "runtime.reload", "geodata.refresh", "ddns.run", "certificates.get"}
View Source
var MasterMessageTypes = []string{"state.sync", "config.apply", "users.sync", "users.delta", "user.controls", "traffic.ack", "command", "command.cancel"}
Functions ¶
func UserEmail ¶
UserEmail binds authenticated transports to the current credential generation. A revoked mux transport cannot authenticate new leaf streams using only a stable user ID.
func ValidateUsers ¶
Types ¶
type Certificate ¶
type Certificate struct {
Provider string `json:"provider,omitempty"`
Config config.CertConfig `json:"config"`
}
type Config ¶
type Config struct {
Xray json.RawMessage `json:"xray"`
Users []User `json:"users"`
Providers map[string]Provider `json:"providers,omitempty"`
Certificates map[string]Certificate `json:"certificates,omitempty"`
InboundCertificates map[string]string `json:"inbound_certificates,omitempty"`
DDNS []DDNSJob `json:"ddns,omitempty"`
DNS DNSPolicy `json:"dns,omitempty"`
Firewall FirewallPolicy `json:"firewall,omitempty"`
BlockedPorts []PortRange `json:"blocked_ports,omitempty"`
AssetHashes map[string]string `json:"asset_hashes,omitempty"`
Updates UpdatePolicy `json:"updates,omitempty"`
Telemetry TelemetryPolicy `json:"telemetry,omitempty"`
Torrent TorrentPolicy `json:"torrent,omitempty"`
}
func ParseConfig ¶
func (Config) BanDuration ¶
func (Config) ReportInterval ¶
func (Config) SampleInterval ¶
type DDNSJob ¶
type DDNSJob struct {
ID string `json:"id"`
Provider string `json:"provider"`
Zone string `json:"zone"`
Name string `json:"name"`
IPv4 string `json:"ipv4,omitempty"`
IPv6 string `json:"ipv6,omitempty"`
Interface string `json:"interface,omitempty"`
IPv4URL string `json:"ipv4_url,omitempty"`
IPv6URL string `json:"ipv6_url,omitempty"`
TTLSeconds int `json:"ttl_seconds,omitempty"`
IntervalSeconds int `json:"interval_seconds,omitempty"`
}
type FirewallPolicy ¶
type FirewallPolicy struct {
Enabled bool `json:"enabled"`
Protect bool `json:"protect"`
TCPPorts []int `json:"tcp_ports,omitempty"`
UDPPorts []int `json:"udp_ports,omitempty"`
SSHPorts []int `json:"ssh_ports,omitempty"`
AllowPrefixes []string `json:"allow_prefixes,omitempty"`
Forward []Forward `json:"forward,omitempty"`
}
type Message ¶
type TelemetryPolicy ¶
type TorrentPolicy ¶
type UpdatePolicy ¶
type User ¶
type User struct {
ID int `json:"id"`
UUID string `json:"uuid,omitempty"`
// Native client/account properties, keyed by inbound tag. Email and level are managed.
Credentials map[string]json.RawMessage `json:"credentials,omitempty"`
InboundTags []string `json:"inbound_tags"`
ActiveIPLimit int `json:"active_ip_limit,omitempty"`
ConnectionLimit int `json:"connection_limit,omitempty"`
SpeedLimitMbps int `json:"speed_limit_mbps,omitempty"`
BurstSpeedLimitMbps int `json:"burst_speed_limit_mbps,omitempty"`
SpeedLimitAfterSeconds int `json:"speed_limit_after_seconds,omitempty"`
SpeedLimitResetSeconds int `json:"speed_limit_reset_seconds,omitempty"`
BlockNew bool `json:"block_new,omitempty"`
}
type UserControl ¶
func (*UserControl) UnmarshalJSON ¶
func (u *UserControl) UnmarshalJSON(b []byte) error
type UserControls ¶
type UserControls struct {
Users []UserControl `json:"users"`
}
type UsersDelta ¶
Click to show internal directories.
Click to hide internal directories.