nym

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package nym sets up and runs the official nym-socks5-client release binary.

zecmix does not reimplement the mixnet. Nym's own client does the Sphinx packet construction, cover traffic, Poisson delays and gateway handling, and exposes a SOCKS5 port that zecmix talks to.

Index

Constants

View Source
const (
	NymAPI    = "https://validator.nymtech.net/api"
	DefaultID = "zecmix"
	// DefaultPort is 1080, Nym's own default for the SOCKS5 client.
	DefaultPort = 1080
)

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath(id string) string

ConfigPath of the socks5 client with this id.

func Described

func Described(api string) (map[int]DescribedNode, error)

Described returns every node the nym-api describes, keyed by node id.

func FindBinary

func FindBinary(explicit string) (string, error)

FindBinary locates nym-socks5-client: explicit path, $ZECMIX_NYM_SOCKS5, then $PATH.

func Home

func Home() string

Home is $NYM_HOME or ~/.nym.

func Init

func Init(binary, id, provider string, port int, anonymous bool, gateway string) (string, error)

Init runs `nym-socks5-client init` with reply SURBs on by default (the exit then never learns this client's mixnet address).

func LogFile

func LogFile(id string) string

func PatchConfig

func PatchConfig(id string) (bool, error)

PatchConfig works around nym-socks5-client 1.1.86 (v2026.19) writing a config it can't read: the template omits credential_requests_database while the loader requires it, so `run` fails right after `init` with "missing field `credential_requests_database`". Adds the default path.

func PatchConfigText

func PatchConfigText(text string) (bool, string)

PatchConfigText is PatchConfig on a string (for tests).

func RunningPID

func RunningPID(id string) int

RunningPID returns the pid of the client started by zecmix, or 0.

func StateDir

func StateDir() string

StateDir is $XDG_STATE_HOME/zecmix (pid files, logs, local cert).

func Stop

func Stop(id string) bool

Stop terminates the client started by zecmix.

Types

type DescribedNode

type DescribedNode struct {
	NodeID      int `json:"node_id"`
	Description struct {
		Host struct {
			IPs []string `json:"ip_address"`
		} `json:"host_information"`
		NetworkRequester *struct {
			Address        string `json:"address"`
			UsesExitPolicy bool   `json:"uses_exit_policy"`
		} `json:"network_requester"`
		Aux struct {
			Location string `json:"location"`
		} `json:"auxiliary_details"`
		Build struct {
			Version string `json:"build_version"`
		} `json:"build_information"`
		Roles struct {
			ExitNR bool `json:"exit_nr"`
		} `json:"declared_role"`
	} `json:"description"`
}

DescribedNode is the subset of /v1/nym-nodes/described we use.

func NodeByIP

func NodeByIP(api, ip string) (*DescribedNode, error)

NodeByIP finds which Nym node announces ip (used to show that a server saw a Nym exit gateway's address).

type ExitProvider

type ExitProvider struct {
	NodeID      int      `json:"node_id"`
	Country     string   `json:"country"`
	Performance float64  `json:"performance"`
	Version     string   `json:"version"`
	Address     string   `json:"address"`
	IPs         []string `json:"ips"`
}

ExitProvider is a network requester on an active exit gateway.

func ListExitProviders

func ListExitProviders(api string, minPerf float64) ([]ExitProvider, error)

ListExitProviders asks the nym-api for network requesters on currently active exit gateways that enforce the exit policy.

This queries the public nym-api directly (not through the mixnet), exactly as nym-socks5-client itself does to fetch the network topology. It reveals that you use Nym, nothing about your wallet.

func PickProvider

func PickProvider(ps []ExitProvider) (ExitProvider, error)

PickProvider chooses at random (spreads load, keeps the choice unpredictable).

type Status

type Status struct {
	ID               string `json:"id"`
	PID              int    `json:"pid"`
	SOCKS5           string `json:"socks5"`
	Provider         string `json:"provider"`
	AnonymousReplies bool   `json:"anonymous_replies"`
	ClientAddress    string `json:"client_address"`
	Gateway          string `json:"gateway"`
	Log              string `json:"log"`
}

Status of a configured client.

func GetStatus

func GetStatus(id string) (Status, error)

GetStatus reads the client's config and log.

func Start

func Start(binary, id string, wait time.Duration) (Status, error)

Start launches `nym-socks5-client run` in the background and waits until it reports "Client startup finished".

Jump to

Keyboard shortcuts

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