Skip to content

The configuration file

katana reads one TOML file that describes everything the panel does not: which panels to talk to, which certificates to serve, where traffic may go, and how names are resolved. This page covers the file as a whole: its four top-level sections, the rules katana applies when it parses them, the process-wide [log] and [dns] sections, and how several [[node]] blocks share one process.

Read it when you write your first config, when you add a second node, or when --test rejects a file and you want to know why. The contents of each node, the outbounds and the routing rules each have their own page, linked from the tables below.

The smallest useful file names one panel node. Everything else has a default:

/etc/katana/config.toml
[[node]]
panel_type = "NewV2board"
[node.api]
host = "https://panel.example.com"
node_id = 1
key = "replace-with-the-panel-key"
node_type = "V2ray"

Check it without starting anything:

Terminal window
katana --test -c /etc/katana/config.toml

A valid file prints Configuration OK and exits with status 0. An invalid one prints configuration error: followed by the reason, and exits with status 1. Without -c, katana reads config.toml from the working directory.

This file is enough for --test, but a real node usually needs more. If the panel marks the node as TLS, katana also needs a certificate in [node.controller.cert], and --test cannot know that because it does not contact the panel. Nodes covers what each node type needs.

A complete file has four top-level sections. [log] is process-wide, every [[node]] block is one panel node with its own sub-tables, and [dns] and the [[outbound]] blocks are written once and built by every node.

[log] # process-wide: the log filter
[dns] # written once: the resolver every node builds
[[node]] # one block per panel node
[node.api] # how to reach the panel, and what the node is
[node.controller] # bind address, poll interval, feature switches
[node.controller.cert] # the certificate for TLS and Hysteria2 nodes
[node.hysteria] # Hysteria2 listener settings
[node.route] # this node's default outbound and geodata files
[[node.route.rule]] # this node's routing rules, first match wins
[[outbound]] # one block per named upstream, built by every node

TOML attaches each sub-table to the most recent [[node]] above it, so write a node’s sub-tables directly after its [[node]] line and before the next one.

Section Scope Documented on
[log] process this page
[dns] process this page
[[node]], [node.api], [node.controller], [node.controller.cert] one node Nodes
[node.hysteria] one Hysteria2 node Hysteria 2 nodes
[node.route], [[node.route.rule]] one node Routing
[[outbound]] every node Outbounds
KeyTypeRequiredDefaultDescription
logtableno{}Logging, written as [log]. Holds only level. Unlike etemenanki-app, katana applies a changed level on hot reload.
dnstableno{}Name resolution for every outbound of every node, written as [dns]. Each node builds its own resolver and cache from it. Without it, katana uses the host resolver behind an always-on cache. The panel HTTP requests do not use it. A hot reload that changes it drops every connection on every node.
nodearray of tablesyes—The panel nodes to serve, one [[node]] block each, with the sub-tables [node.api], [node.controller], [node.controller.cert], [node.hysteria], [node.route] and [[node.route.rule]]. Written in the singular, as an array of tables. The file parses without any, but both --test and a normal start fail with config defines no [[node]] entries.
outboundarray of tablesno[]Named upstream proxies, one [[outbound]] block each. Written in the singular. The definitions are shared: every node builds its own copy of each one, and its route table names them by tag. The tags direct, freedom, block and blackhole always exist and cannot be redefined, and tags that start with audit# are reserved for audit rules; a reserved or repeated tag fails with duplicate/reserved outbound tag <tag>. A hot reload that changes any [[outbound]] drops every connection on every node.

The diagram shows how the sections relate at run time. Each node has its own panel and its own routing table, and each builds its own copy of the outbounds and of the [dns] resolver from the definitions in the file.

flowchart LR
  DEF["[[outbound]] and [dns] in the file"]
  P1["Panel A"] --> N1["node 1"]
  P2["Panel B"] --> N2["node 2"]
  N1 --> R1["node 1 route table"]
  N2 --> R2["node 2 route table"]
  R1 --> O1["node 1 outbounds and resolver"]
  R2 --> O2["node 2 outbounds and resolver"]
  DEF -.-> O1
  DEF -.-> O2

There is no top-level [route]. Routing lives under each node as [node.route], and a top-level [route] table fails the parse as an unknown field.

Every table in the file rejects keys it does not know, and no key has an alias. A misspelt key stops katana instead of being skipped, so a typo cannot quietly leave a setting at its default. The error starts with the line and column of the mistake:

configuration error: config parse error: TOML parse error at line 3, column 1

Values are typed just as strictly: node_id = "1", node_id = -1 and level = 3 all fail the same way. The file must be UTF-8; anything else fails with config not utf-8.

Key names are snake_case and exactly as the reference tables list them. XrayR’s YAML used names such as ApiHost and NodeID; katana’s equivalents are host and node_id under [node.api]. Migrating from XrayR covers the differences.

Some values that name a choice are matched without regard to case, so panel_type = "NewV2board" and panel_type = "newv2board" are the same. Others must be written exactly in lower case. The table lists every such value in the file:

Value Case Example of an accepted spelling
[[node]].panel_type any "NewV2board", "V2board", "Helium"
[node.api].node_type any "V2ray", "Trojan", "Shadowsocks", "AnyTLS", "Socks", "Http", "Hysteria2"
[[outbound]].protocol any "socks", "Shadowsocks", "WireGuard"
[[outbound]].security any "auto", "AES-128-GCM"
[[outbound]].address_family any, and - counts as _ "ipv4_only", "IPv4-Only"
[[outbound]].method, Shadowsocks 2022 names exact "2022-blake3-aes-256-gcm"
[[outbound]].method, other ciphers any "aes-128-gcm", "CHACHA20-POLY1305"
[dns].backend exact "system", "udp", "tls", "https"
[node.controller.cert].mode exact: only "file" loads a certificate "none", "file"
[node.hysteria].congestion exact "cubic", "bbr", "reno"
[node.hysteria].credential, obfs exact "uuid", "user_pass", "salamander"

When katana reports an unknown panel_type, the message shows the value in lower case: panel_type = "XBoard" fails with unknown panel_type "xboard".

Paths in the file, such as cert_file, key_file, geoip, geosite, rule_list_path and ca_file, are opened as written. A relative path is resolved against katana’s working directory, not against the directory of the config file. A systemd service runs in / unless its unit sets WorkingDirectory=, so use absolute paths such as /etc/katana/geoip.dat.

--test builds as much of the configuration as it can without binding a port or contacting a panel. It stops at the first error, in this order:

  1. It reads and parses the file, which catches unknown keys, wrong types and invalid UTF-8.
  2. It checks that there is at least one [[node]].
  3. It warns about any WireGuard outbound that more than one node routes to (see Several nodes in one file).
  4. For each node in turn, it builds the panel client, which checks panel_type and refuses the removed SSpanel by name. On NewV2board and V2board the client also checks node_type and refuses sss, which only helium describes. A helium node is refused if it sets a key its panel describes: node_type, enable_vless, or a [node.hysteria] key other than congestion. Then --test checks the keys it can judge on its own: real_ip_header with real_ip_from, and handoff_dir with handoff_group in [node.controller], looking the group up in /etc/group; and [node.hysteria] congestion, on every node. Then it builds what the node would run short of what the panel sends: every [[outbound]], checking that no tag repeats or is reserved; the [dns] resolver, reading ca_file if set; and [node.route], reading the geodata files that the rules use. For a node whose node_type is Hysteria2 it also builds the listener from [node.hysteria] and reads the certificate and key. A helium node has no node_type, so it gets neither, whatever its panel describes.

An error names the node it was found in, such as configuration error: node 1: duplicate/reserved outbound tag direct. An error in an [[outbound]] or in [dns] is reported for the first node, since every node builds them.

Everything the panel decides is out of its reach. --test does not check that the panel URL and key work, that the port the panel assigns is free, or that a TLS node’s certificate files exist. It also does not check [log].level or read rule_list_path. Those problems show up in the log when the node starts.

[log] sets which log lines katana writes to standard output.

KeyTypeRequiredDefaultDescription
levelstringno"info"A tracing EnvFilter directive, the same syntax as RUST_LOG: a level (off, error, warn, info, debug, trace, or a number from 0 to 5, case-insensitive), optionally followed by per-target overrides such as "info,etemenanki_supervisor=debug". At startup a RUST_LOG variable that holds a valid filter takes precedence. --test does not validate it: at startup an unparsable directive is skipped with an ignoring ... line on stderr, and a word that is not a level, such as "warning", is read as a target name and silences every log line, errors included. A hot reload that changes the value applies it and replaces the RUST_LOG filter; a value that does not parse is logged as invalid log level and the current filter stays.
[log]
level = "info,etemenanki_supervisor=debug"

At startup, katana takes its filter from the RUST_LOG environment variable if that variable holds a valid filter, and from [log].level otherwise. RUST_LOG=debug katana -c /etc/katana/config.toml is a quick way to get more detail from one run without editing the file.

Unlike etemenanki-app, katana applies a changed level on hot reload. When a reload finds a different level, katana installs it, logs reload: log level → <level> at info level, and from then on the file wins over RUST_LOG. If the new value does not parse, katana logs invalid log level and keeps the current filter. Removing the key sets the level back to info. A reload that does not change level leaves the current filter alone, including one that came from RUST_LOG.

[dns] chooses how every node’s outbounds turn host names into addresses. It is the same resolver etemenanki-app uses, configured with the same keys and the same rules; DNS describes the resolver itself in more depth.

KeyTypeRequiredDefaultDescription
backendstring (enum)no"system"Where answers come from: "system" (the host resolver, which honours /etc/hosts and nsswitch.conf), "udp" (plain DNS), "tls" (DNS over TLS, RFC 7858) or "https" (DNS over HTTPS, RFC 8484). Case-sensitive, unlike most katana enums: "UDP" fails with dns: unknown backend "UDP" (expected "system", "udp", "tls" or "https").
serverstringdepends—Required for udp, tls and https (dns: the udp backend needs a server address). The resolver's socket address as an IP literal with a port, such as "192.0.2.53:53" or "[2001:db8::53]:853". A host name or a missing port is refused with dns: invalid server address: invalid socket address syntax, because there is nothing yet to resolve it with. For https this is the address katana dials; url gives the name and the path.
server_namestringdepends—Required for tls. The name sent as SNI and checked against the resolver's certificate. It is never guessed from server; a missing value fails with dns: the tls backend needs a server name to verify against. The https backend takes its name from url instead.
urlstringdepends—Required for https (dns: the https backend needs the resolver's url). Must start with https:// (dns: "…" is not an https:// url). The host is sent as SNI and as the Host header and is what the certificate is checked against, so write it as a name; everything from the first / on is the request path, and /dns-query is used when there is none. A URL with userinfo (user@) or an empty host is refused.
ca_filepathno—PEM file of extra CA certificates that tls and https trust in addition to the system roots, for a resolver with a private certificate. A file with no certificate fails with no certificate in CA PEM bundle. A relative path resolves against the working directory.
# The default; the same as leaving [dns] out.
[dns]
backend = "system"

The host resolver, through getaddrinfo. It is the only backend that honours /etc/hosts, nsswitch.conf and search domains.

To trust a resolver whose certificate comes from a private CA, add ca_file to a tls or https backend. katana adds the certificates in the file to the system roots; it does not replace them, so a resolver with a publicly trusted certificate still passes:

[dns]
backend = "tls"
server = "192.0.2.53:853"
server_name = "dns.example.com"
ca_file = "/etc/katana/dns-ca.pem"

Each node builds its own resolver from [dns], with its own cache, and hands it to all of its outbounds, the built-in direct and freedom included. It resolves:

  • the destinations of traffic that leaves through direct, freedom or a protocol = "direct" outbound;
  • the server names of upstream proxy outbounds;
  • a WireGuard outbound’s server, the peer endpoint, when the tunnel starts, with endpoint_address_family applied;
  • the destinations of traffic sent through a WireGuard outbound.

The panel requests do not go through it: katana’s HTTP client for the panel API uses the host resolver, whatever [dns] says.

Each node’s cache holds up to 8192 names. Host-resolver answers carry no TTL, so katana keeps them for 60 seconds; answers from the other backends are kept for their TTL, clamped to between 5 seconds and 1 hour. With udp, tls and https, each query times out after 5 seconds.

One katana process can serve any number of panel nodes, from the same panel or from different panels. Repeat the [[node]] block once per node, each followed by its own sub-tables. The nodes run independently: each has its own panel client, poll timer, listener, user list, traffic counters, routing table, outbounds and resolver, and a node whose panel is unreachable does not affect the others.

A node that cannot come up the first time, because its panel request for the node or its users fails or because its listener cannot bind, logs node <id>: <reason>; retrying in <N>s and tries again. The first wait is 1 second, and each failure after that doubles it, up to 60 seconds or the node’s update_periodic, whichever is shorter. The other nodes keep running meanwhile. A reload that changes the waiting node’s [[node]] block makes it try again at once, since the edit may be the fix.

Shared by all nodes Separate for each node
[log] panel_type, enable_mtls and everything in [node.api]
the [dns] settings the resolver built from them, and its cache
the [[outbound]] definitions the outbounds built from them, with their connections and tunnels
the process, its file watcher and its signals [node.controller] and its certificate, [node.hysteria], [node.route] and its rules

Because every node builds its own copy of each outbound, a WireGuard outbound that several nodes route to runs one tunnel per node, all with the same key, and a WireGuard peer keeps only one session per key. At startup, on --test and on every reload, katana warns about it:

WARN katana::runtime: wireguard outbound wg is routed to by 2 nodes (newv2board@https://panel.example.com#1/v2ray, helium@https://helium.example.com#2): each brings up its own tunnel with the same key, and the peer keeps only one of them at a time

Give each node that needs a WireGuard exit its own outbound, with its own key.

The example below serves an Xboard VMess node and a helium node from one process. The VMess node sends private addresses to block, example.org and its subdomains to the relay outbound and everything else to direct. The helium node sends everything to relay except the RFC 1918 private ranges and port 25 (SMTP), which go to block. Both nodes route to the relay outbound, which is defined once; each node builds its own copy.

/etc/katana/config.toml
# Two panel nodes in one katana process: an Xboard (newV2board) VMess node and
# a helium node. [dns] and [[outbound]] are defined once and each node builds
# its own copy (each keeps its own resolver cache); each node has its own
# [node.route] table.
#
# Validate with: katana --test -c /etc/katana/config.toml
[log]
level = "info"
# The resolver every node's outbounds use. Each node keeps its own cache.
[dns]
backend = "tls"
server = "192.0.2.53:853"
server_name = "dns.example.com"
# ---------------------------------------------------------------------------
# Node 1: VMess from an Xboard panel. The panel supplies the port, transport
# and TLS flag; the certificate is always local.
# ---------------------------------------------------------------------------
[[node]]
panel_type = "NewV2board"
[node.api]
host = "https://panel.example.com"
node_id = 1
key = "replace-with-the-panel-key"
node_type = "V2ray"
timeout = 10
[node.controller]
listen_ip = "0.0.0.0"
update_periodic = 60
[node.controller.cert]
mode = "file"
cert_file = "/etc/katana/proxy.example.com.crt"
key_file = "/etc/katana/proxy.example.com.key"
[node.route]
default = "direct"
geoip = "/etc/katana/geoip.dat"
[[node.route.rule]]
outbound = "block"
geoip = ["private"]
[[node.route.rule]]
outbound = "relay"
domain_suffix = ["example.org"]
# ---------------------------------------------------------------------------
# Node 2: from a helium panel, which names the protocol itself, so the node
# sets no node_type. The certificate is used whenever the node the panel
# describes runs over TLS.
# ---------------------------------------------------------------------------
[[node]]
panel_type = "Helium"
[node.api]
host = "https://helium.example.com"
node_id = 2
key = "replace-with-the-panel-key"
[node.controller]
update_periodic = 60
[node.controller.cert]
mode = "file"
cert_file = "/etc/katana/proxy.example.com.crt"
key_file = "/etc/katana/proxy.example.com.key"
[node.route]
default = "relay"
[[node.route.rule]]
outbound = "block"
cidr = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
[[node.route.rule]]
outbound = "block"
port = ["25"]
# ---------------------------------------------------------------------------
# Outbounds defined once for every node. `direct`, `freedom`, `block` and
# `blackhole` are built in; these entries add to them.
# ---------------------------------------------------------------------------
[[outbound]]
tag = "relay"
protocol = "shadowsocks"
server = "198.51.100.20"
port = 8388
method = "2022-blake3-aes-256-gcm"
# Generate a real key with: openssl rand -base64 32
password = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

The Shadowsocks 2022 key in the relay outbound is a placeholder. Generate a real one with openssl rand -base64 32.

Each node binds one port on its listen_ip. The panel assigns that port, except for a Hysteria2 node with [node.hysteria].port set, which uses that port and does not ask the panel for one; a helium node cannot set that key. Two nodes that bind the same TCP port on the same address cannot both start: whichever binds second logs node <id>: initial start failed: …; retrying in <N>s and keeps retrying, so it comes up once the port is free. With the default listen_ip = "0.0.0.0", which binds [::] on a dual-stack host, a node takes its port on every IPv4 and IPv6 address. A Hysteria2 node listens on UDP, so it can use the same port number as a TCP node. --test does not check ports.

On a hot reload, katana matches each [[node]] in the new file to a running node by the node’s identity: the combination of

  • panel_type, compared without regard to case;
  • [node.api].host, compared as written;
  • [node.api].node_id;
  • [node.api].key;
  • on NewV2board and V2board, the node type katana asks the panel for: vless for a V2ray, Vmess or Vless node with enable_vless = true, and otherwise node_type in lower case. helium finds a node by its ID alone, so a helium node’s identity has no node type.

The node type is part of the identity because Xboard and V2board look a node up by its ID and the type it is asked for. One node_id asked for as vless and as vmess is two panel nodes, each with its own users and its own traffic, and katana treats it the same way.

When the identity of an entry is unchanged, katana reconfigures the running node in place. That includes the other [node.api] keys, such as timeout and speed_limit, enable_mtls and [node.hysteria]: katana builds a new panel client from the edited block and asks the panel for the node and its users at once. When any part of the identity changes, katana treats the edit as removing one node and adding another: it stops the old node, which reports the traffic it has counted one last time, and starts a new one that contacts the panel from scratch. The order of the [[node]] blocks in the file does not matter. Hot reload lists what each kind of change does to a running node.

The host is compared as a string, so https://panel.example.com and https://panel.example.com/ count as different identities even though both reach the same panel.

katana watches the directory that holds the config file. A change in that directory triggers a reload, and katana then compares the new file with the running one section by section. A file that does not parse is ignored as a whole, with config reload failed, keeping current: … in the log. For a file that parses, each top-level section is handled differently:

Section On reload
[log] A changed level is applied at once, unless the reload is rejected.
[dns] Checked against every node first. If it builds, every node builds a new resolver and drops every connection, and katana logs reload: outbound pool rebuilt.
[[outbound]] Checked against every node first. An outbound that does not build rejects the whole reload with reload: node <name>: <error>; keeping current config, and nothing else is applied. Otherwise every node builds the new outbounds and drops every connection on every node, and katana logs reload: outbound pool rebuilt.
[[node]] Before anything is applied, katana checks every node the file adds and every node whose block changed: its panel client, outbounds, [dns] and routing table. If any of them does not build, the whole reload is rejected with reload: node <name>: <error>; keeping current config and nothing else is applied. Otherwise new identities are started, missing ones are stopped, and changed ones are reconfigured live, [node.api] keys, enable_mtls and [node.hysteria] included, through a new panel client.

A reload that leaves no [[node]] entries in the file stops every node, and katana keeps running with none. An empty file parses, so emptying the file has the same effect. The “at least one node” rule applies only at startup and to --test.

Message Cause Fix
config parse error: TOML parse error at line <n>, column <m> A key katana does not know, such as a top-level [route], [[nodes]] in the plural, or vless_flow and disable_custom_config, which katana 6.0.0 removed; a value of the wrong type; or a node written as [node] instead of [[node]]. Look at the line it names. Routing belongs under each node as [node.route], [[node]] and [[outbound]] are singular, and a node always takes double brackets.
config defines no [[node]] entries No [[node]] block. Add at least one node.
node <id>: unknown panel_type "" A [[node]] without panel_type. Set panel_type to NewV2board, V2board or Helium.
node <id>: panel_type "SSpanel" is not supported: katana serves the NewV2board and Helium panels A node still set up for SSPanel, which katana 6.0.0 removed. Serve the node from Xboard, V2board or helium; see Upgrading to katana 6.
node <id>: unknown panel_type "xboard" The panel’s product name instead of its API type. Xboard and V2board speak the newV2board API: use NewV2board.
node <id>: unknown node_type "vmess2" A node_type katana does not know. Use V2ray, Trojan, Shadowsocks, AnyTLS, Socks, Http or Hysteria2. A helium node sets no node_type.
node <id>: [node.api] node_type is set, but a helium node's protocol is described by the panel; remove it (of [node.hysteria], only congestion is this host's to choose) A helium node sets a key its panel describes. The message names it the same way for enable_vless and every [node.hysteria] key but congestion. Remove the key. See helium.
node <id>: newV2board: no UniProxy panel describes an sss node; sss is Helium's own protocol, served with panel_type = "Helium" node_type = "sss" on NewV2board or V2board. Serve sss nodes from helium.
node <id>: unknown hysteria congestion "vegas" (expected "cubic", "bbr" or "reno") A [node.hysteria] congestion katana does not know. --test checks it on every node, Hysteria2 or not. Use cubic, bbr or reno, in lower case.
node <id>: duplicate/reserved outbound tag direct An outbound tag used twice, one of direct, freedom, block, blackhole, or a tag that starts with audit#. Rename the outbound. To give direct traffic its own settings, add protocol = "direct" under a new tag.
node <id>: route references unknown outbound x A route default or rule outbound that names no outbound. Fix the tag, or add the missing [[outbound]].
dns: unknown backend "UDP" (expected …) A backend in the wrong case, or a name such as "doh". Use system, udp, tls or https in lower case.
dns: invalid server address: invalid socket address syntax A host name, or an address without a port, in [dns].server. Write an IP address and port, such as "192.0.2.53:53".
No such file or directory (os error 2) The config file itself, or a file named in it, is missing: [dns].ca_file, a geodata file, or a Hysteria2 certificate. Check every path, and use absolute paths.

Troubleshooting covers errors that appear only once a node is running.