xrayconf

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package xrayconf builds xray-core JSON configs from saved server profiles. It's shared by the desktop app and the Android app (github.com/freeb5d/kite-android), so both speak every link shape the same way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(server profile.Server, o Options) ([]byte, error)

Build returns an xray-core JSON config for server. The proxy outbound is tagged "proxy" and its traffic counters are registered as "outbound>>>proxy>>>traffic>>>uplink"/"downlink" in xray's stats.Manager.

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

FirstNonEmpty returns the first non-empty value.

func Outbound

func Outbound(server profile.Server) (map[string]interface{}, error)

Outbound builds the "proxy" outbound for server.

Types

type Options

type Options struct {
	HTTPPort  int    // local HTTP proxy port; 0 = no HTTP inbound
	SOCKSPort int    // local SOCKS5 proxy port; 0 = no SOCKS inbound
	TUN       bool   // add xray's TUN inbound
	TUNName   string // TUN adapter name (desktop); ignored on Android
	LogPath   string // xray error/debug log file; empty = stderr
	LogLevel  string // xray loglevel; default "debug"

	// SSHBridgePort is the local SOCKS port of a running sshbridge.Bridge;
	// required for "ssh" servers, which xray-core can't speak itself.
	SSHBridgePort int

	// DirectPrivate sends private/local network addresses (LAN, the
	// carrier's internal DNS, ...) out directly instead of via the server.
	// Only safe where xray's own sockets bypass the TUN (Android).
	DirectPrivate bool
}

Options selects what the generated config listens on.

Jump to

Keyboard shortcuts

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