integrate

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package integrate detects installed proxy clients (Xray, v2ray, sing-box, NekoBox) and patches their config so their outbound server address becomes 127.0.0.1:40443 (snix's listen address) while the real upstream address is stored in snix's own config.

Every Patch() call:

  • backs up the original config to <path>.bak before writing
  • preserves unrelated fields by round-tripping through a generic map
  • returns an error before writing anything if the config is structurally unexpected (safer to fail than to corrupt).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Name is a short label ("xray", "v2ray", "sing-box", "nekobox").
	Name string
	// Binary is the absolute path to the executable (diagnostic only).
	Binary string
	// ConfigPath is the file we would patch.
	ConfigPath string
	// Patch rewrites the config so the client's outbound server is
	// snix's listen address. origHost+origPort is the user's real proxy
	// server address (what snix will forward to). Returns an error if
	// the config doesn't match the expected shape; the backup is always
	// written before any modification.
	Patch func(origHost string, origPort uint16) error
}

Client describes one detected proxy client's install.

func Detect

func Detect() []Client

Detect scans the current system for supported proxy clients and returns one Client entry for each found install. Order is not stable.

Jump to

Keyboard shortcuts

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