Skip to content

Nodes

A katana configuration file serves one node for each [[node]] block it contains. The block says which panel to ask and which node ID to ask for. It also covers the parts of the node the panel does not decide: the address to listen on, how often to poll, the certificate, and a few switches. The panel supplies everything else, including the port, transport, TLS setting, cipher and users, and on helium the protocol itself.

This page describes every key of [[node]], [node.api], [node.controller] and [node.controller.cert]. It also shows how several nodes share one process, how a hot reload decides whether an edited block is still the same node, and what happens when a node cannot start. Routing ([node.route]) and the Hysteria 2 table ([node.hysteria]) have their own pages, linked at the end.

Both examples serve one node with a certificate you manage yourself, used when the panel turns TLS on. Pick the tab for your panel.

/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"
enable_vless = true # serve VLESS; leave false for VMess
timeout = 10
[node.controller]
listen_ip = "0.0.0.0"
update_periodic = 60
[node.controller.cert]
mode = "file"
cert_file = "/etc/katana/fullchain.pem"
key_file = "/etc/katana/privkey.pem"

Check the file before you start katana:

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

--test catches unknown keys, wrong types, an unknown panel_type or node_type, the removed SSpanel, a helium node that sets a key its panel describes, and outbounds, [dns] settings or routing rules that do not build; its errors name the node, as in configuration error: node 1: …. It sends no request to the panel and binds nothing. It reads the certificate files only for a node whose node_type is a Hysteria 2 value; a helium node has no node_type, so --test reads none for it. Whether the panel accepts the URL and key, and whether the certificate is there, therefore shows up only when the node starts, as an error that the node retries until you fix the cause. When a node fails to start covers those errors.

[[node]] is an array of tables: write one block for each node, each with its own sub-tables. Only panel_type and enable_mtls sit directly in the block.

KeyTypeRequiredDefaultDescription
panel_typestring (enum)yes—Which panel API this node talks to: NewV2board (UniProxy, for Xboard and V2board), its alias V2board, or Helium (Helium's node API v2, whose node config describes the whole inbound, so a helium node sets no node_type). Compared case-insensitively. katana 6.0.0 removed SSPanel: SSpanel, in any case, fails --test with node <id>: panel_type "SSpanel" is not supported: katana serves the NewV2board and Helium panels, quoting the value as written. Leaving the key out fails --test with node <id>: unknown panel_type ""; any other value fails the same way, with the value shown lowercased. At startup, a node refused for either reason is logged and skipped, and katana exits only when no node can be started. On a hot reload, such a value makes katana refuse the whole reload and keep running the current configuration. Part of the node identity.
enable_mtlsboolnotrueWhether katana presents its client certificate to a panel that asks for one. With true, the default, it does. With false it presents none, even to a panel that asks: set it for a panel that should not receive the certificate. Works with every panel_type. Not part of the node identity: a hot reload that changes it alone gives the node a new panel client without a restart. The new client reads the node settings and users again at once, and the node keeps its connections unless the answer changes the protocol or transport.
apitableyes—How to reach the panel and what to ask it for, written as [node.api]: the panel URL, node ID and key, the node type (except on helium, whose panel describes the protocol), plus a few local overrides.
controllertableno{}This machine's side of the node, written as [node.controller]: listen address, poll interval, the sniffing, rule, upload and VMess clock switches, the device limit and IP ban, and the [node.controller.cert] certificate table. Every key has a default.
routetableno{}This node's routing table, written as [node.route] with [[node.route.rule]] blocks. Without it, every flow goes to the direct outbound.
hysteriatableno{}Settings for a Hysteria 2 node, written as [node.hysteria]: credential format, UDP relay, masquerade, congestion control, overrides of the panel's rates, and optionally a local port and obfuscation. Used only by a Hysteria 2 node: one whose node_type is a Hysteria 2 value, or on helium one the panel describes as hysteria2. A helium node refuses every key but congestion, since its panel describes the rest; congestion is checked on every node. A hot reload that changes the table gives the node a new panel client and drops every connection on it.

Every table in the block rejects unknown keys, so a typo stops --test and startup instead of being ignored. The error starts with the line and column of the mistake:

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

[node.api] tells katana where the panel is, how to authenticate, and which node to ask for. It also holds three local overrides: enable_vless (refused on helium), speed_limit and rule_list_path.

KeyTypeRequiredDefaultDescription
hoststringyes—Base URL of the panel, with the scheme: https://panel.example.com. If the panel is served under a path, include it. Trailing slashes are removed before katana appends the API path. Part of the node identity, compared exactly as written.
node_idu32yes—The node's ID in the panel, a non-negative integer. Part of the node identity.
keystringyes—The panel's node communication key: the server token in Xboard and V2board, the node's own API token in helium. UniProxy panels receive it as the token query parameter on every request; helium receives it in an Authorization: Bearer header, never in the URL. Part of the node identity.
node_typestring (enum)depends—What kind of node the panel describes, compared case-insensitively. Required on NewV2board and V2board, where leaving it out fails with unknown node_type ""; refused on Helium. The values: V2ray, vmess or vless (all three mean a V2ray node, VMess unless enable_vless is on), Trojan, Shadowsocks, AnyTLS, Socks or socks5, Http (4.9.0 and later), or Hysteria2, hysteria or hy2. katana also knows sss, but sss nodes are helium-only: NewV2board and V2board refuse it with newV2board: no UniProxy panel describes an sss node; sss is Helium's own protocol, served with panel_type = "Helium". UniProxy panels receive the value lowercased as the node_type query parameter (or as vless for a V2ray node with enable_vless on), so write it the way the panel spells it. When a UniProxy panel names the protocol in its node config, as Xboard does, a protocol of another family refuses the node. A helium node refuses the key, because its panel describes the protocol: [node.api] node_type is set, but a helium node's protocol is described by the panel; …, at --test, at start and on a reload. On NewV2board and V2board, the type katana asks for is part of the node identity, so a hot reload that changes the requested type (anything but case) replaces the node. Any other change builds a new panel client on a hot reload and applies at once.
enable_vlessboolnofalseServe VLESS instead of VMess on a V2ray node. A UniProxy panel is then asked for node_type=vless. On NewV2board and V2board, turning it on or off for a node whose node_type is V2ray or vmess changes the type katana asks for, which is part of the node identity, so a hot reload replaces the node. With node_type = "vless" the type asked for is vless either way, so a hot reload that changes it builds a new panel client, which switches the node between VLESS and VMess at once and drops every connection on it. On other node types it has no effect. A helium node refuses it, because its panel says whether the node is VMess or VLESS: [node.api] enable_vless is set, but a helium node's protocol is described by the panel; ….
timeoutu64no0Limit for each panel HTTP request, in seconds, from connecting until the whole response has been read. 0 means 5 seconds. A hot reload that changes it builds a new panel client in place, without replacing the node.
speed_limitfloatno0Speed-limit override in Mbps (1 Mbps is 125 000 bytes per second; fractions and integers are both accepted). Above 0, it replaces the limit the panel gives each user of this node, so every user gets exactly this rate. On helium it replaces the one speed limit each users answer gives every user, and the device limit stays the panel's. 0 or a negative value uses the panel's limits. A hot reload that changes it builds a new panel client and keeps every connection; the new rate applies at once, to connections already open as well.
device_limitintegerno0Has no effect; kept for XrayR compatibility. Per-user device limits come from the panel and are enforced with [node.controller].enable_device_limit.
rule_list_pathpathno""A local file of audit rules, one regular expression per line; blank lines and lines starting with # are skipped. A rule is matched against the flow's domain name in lower case: the name the client asked for, or the name sniffed from its first bytes. A flow addressed by IP with no sniffed name never matches. A matching flow goes to a blackhole outbound, which discards it. Read together with the panel rules, so disable_get_rule = true also turns this file off. Re-read at every rule refresh, so edits to its contents apply at the next cycle. An unreadable file or an invalid line is logged and skipped. On helium, whose node config carries no routes, this file is the node's only source of audit rules. katana reports hits to no panel. A hot reload that changes the path builds a new panel client, which reads the new file at once; connections are kept.

host is the base URL. katana removes trailing slashes and appends the API path, so https://panel.example.com/ and https://panel.example.com reach the same URLs. If the panel runs under a path, include it: https://example.com/panel makes katana request https://example.com/panel/api/v1/server/UniProxy/config.

Always include the scheme, https:// or http://, and write the URL the panel answers at. katana presents a client certificate when a panel asks for one, unless the node sets enable_mtls = false, and does not follow redirects, so a host that redirects, from http:// to https:// or to another path, never reaches the panel.

katana sends the key with every request, in the query string under the parameter names each panel expects, or for helium in a header.

Panel Node settings request Other requests
NewV2board / V2board GET /api/v1/server/UniProxy/config?node_id=…&node_type=…&token=… Same three parameters on …/user and …/push
Helium GET /api/node/v2/<node_id>/config with Authorization: Bearer … The same header on …/users and …/report; the key never appears in a URL

A UniProxy panel looks a node up by its ID and its type together. katana sends node_type lowercased, except that a V2ray node with enable_vless = true is sent as vless. For the node types katana serves, Xboard knows vmess, vless, trojan, shadowsocks, hysteria, anytls, socks and http, plus the aliases v2ray and hysteria2, so:

  • for a VLESS node, set enable_vless = true. node_type = "vless" alone asks the panel for the VLESS node but serves VMess on it;
  • for a Hysteria 2 node, write Hysteria2 or hysteria. katana also accepts hy2, but Xboard does not recognise it;
  • for a SOCKS node, write Socks. katana also accepts socks5, but Xboard does not recognise it.

helium finds a node by its ID alone, and its node config describes the protocol, so a helium node sets no node_type or enable_vless: katana refuses one that does, at --test, at start and on a reload; see Keys the panel describes. sss nodes are served from helium alone: NewV2board and V2board refuse node_type = "sss" with newV2board: no UniProxy panel describes an sss node; sss is Helium's own protocol, served with panel_type = "Helium".

The per-panel pages list every field katana reads from each panel.

speed_limit is in megabits per second, and katana converts 1 Mbps to 125 000 bytes per second. When it is above 0, it replaces every limit the panel sends for this node. When it is 0 or negative, katana uses the panel’s own limits.

speed_limit Panel limits Each user’s rate
0 User limit only (UniProxy) The user’s limit, or unlimited if it is 0
0 One limit for every user (helium) That limit, or unlimited if it is 0
50 Any 50 Mbps (6 250 000 bytes per second), whatever the panel says

The override is not a total for the node: it applies to each user separately. Speed limits explains how the limit is enforced.

rule_list_path names a text file of regular expressions, one per line. katana matches each rule against the flow’s domain name in lower case, the name the client asked for or the name sniffed from its first bytes, and sends a matching flow to a blackhole. A flow addressed by IP with no sniffed name never matches a rule; to block addresses, route them to block with a cidr rule instead (Routing). The rules are unanchored, so example\.com also matches example.com.example.net; write (^|\.)example\.com$ to match a domain and its subdomains only.

/etc/katana/rules.txt
# One regular expression per line. Blank lines and lines starting with # are skipped.
(^|\.)tracker\.example\.com$
(^|\.)ads\.example\.net$

katana reads the file in the same refresh that fetches the panel’s rules, so disable_get_rule = true turns the file off as well. katana re-reads the file on every cycle, so an edit to its contents applies at the next cycle. On helium the file holds the node’s only audit rules, because its node config carries no routes. A line that is not a valid regular expression is logged and skipped. katana reports hits to no panel. Destination audit covers panel rules and refresh timing.

katana 6.0.0 removed SSPanel, and with it the two [node.api] keys only SSPanel read, vless_flow and disable_custom_config. [node.api] rejects unknown keys, so a file that still sets either fails the parse as an unknown key, at --test, at startup and on a reload. Delete them. Upgrading to katana 6 lists every change.

[node.controller] holds the settings that belong to this machine: where to listen, how often to talk to the panel, switches for sniffing, rule fetching, traffic upload and the VMess clock check, the device limit and IP ban, where a WebSocket node behind a reverse proxy finds its clients’ addresses (Device limits and IP bans), and the socket on which a relay on the same host hands connections over (Handed-over connections).

KeyTypeRequiredDefaultDescription
listen_ipstringno"0.0.0.0"Address the listener binds: UDP for Hysteria 2 nodes, TCP for every other node type. The port always comes from the panel (or from [node.hysteria].port). Write an IPv4 or IPv6 address without brackets, such as "0.0.0.0", "::" or "203.0.113.10". 0.0.0.0 means every address, IPv6 included: where this host's IPv6 sockets also take IPv4, katana binds ::, and the start-up log reads listening on [::]:<port>. Where they do not, katana binds 0.0.0.0; with net.ipv6.bindv6only set it warns IPv6 sockets here take IPv6 alone (net.ipv6.bindv6only), so listen_ip 0.0.0.0 serves IPv4 only. Any other address is bound as written. The value as written is also part of the node tag, such as V2ray_0.0.0.0_443. A node on one address also puts it in its handoff socket's name; see handoff_dir.
send_ipstringno"0.0.0.0"Has no effect: katana does not bind outgoing connections to a source address; the operating system chooses it.
update_periodicu64no60Seconds between poll cycles. One timer drives everything: fetching the node settings and users, refreshing the audit rules, and reporting traffic. 0 counts as 1. The panel's own push and pull intervals are not read. The first cycle runs one full period after the node is up. It also caps the wait between attempts while a node retries its first start, which otherwise grows to 60 seconds. A hot reload that changes it restarts the timer.
disable_upload_trafficboolnofalseStop reporting user traffic to the panel. Speed limits and audit rules still apply. Traffic counted while it is on is discarded, so turning it off again reports only what moves from then on. Read on every cycle, so a hot reload applies it at the next cycle.
disable_get_ruleboolnofalseStop fetching audit rules, both from the panel and from rule_list_path. Set at startup, the node runs with no audit rules.
disable_sniffingboolnofalseStop reading the TLS SNI or HTTP Host from the first bytes of each TCP flow. The sniffed name feeds both the routing rules and the audit rules, so with sniffing off, a flow addressed by IP matches neither a domain rule nor an audit rule. The destination katana connects to is never changed. A hot reload that changes it drops every connection on the node.
disable_vmess_clock_checkboolnofalseVMess nodes only (a V2ray node serving VMess). By default a VMess handshake is accepted only while its timestamp is within 120 seconds of the server clock, either way. With true, any plausible timestamp passes, so a client whose clock is wrong still connects. The cost is replay protection: a handshake replayed more than 240 seconds after it first arrived is served again. When it is on, the node logs node <id>: VMess clock check off at start. A hot reload that changes it runs one poll at once, logs VMess clock check on or off, applies to new connections and keeps the open ones.
enable_device_limitboolnofalseHold each user to the device limit the panel sends, and ban client IPs that keep failing to authenticate. Both count client IP addresses, so turn it on only where katana sees them: clients connect directly, the relays in front of the node send a PROXY protocol v2 header, or, on a WebSocket node, a trusted reverse proxy names them in real_ip_header. On helium it also makes katana report the client addresses users connect from. The Device limits and IP bans page describes both. A hot reload that changes it applies to new connections and keeps the open ones.
real_ip_headerstringdepends—WebSocket nodes behind a reverse proxy: the header of each WebSocket upgrade request that names the client, such as "X-Real-IP" or "X-Forwarded-For". Unset, the node reads no header. The header counts only on a connection from an address in real_ip_from; from anyone else it is ignored. A list names the rightmost address outside real_ip_from, or the leftmost when every address is inside it. A trusted proxy that sends no such header, or one that is not a list of IP addresses, is served as the client itself. The address it names is what the device limit, the IP ban and helium's reports count. Set it together with real_ip_from: alone it fails with real_ip_header needs real_ip_from: the proxies trusted to set it, and a value that is not a header name fails with real_ip_header "<value>" is not a header name. katana checks both keys on every node, at --test, at start and on a reload, but only nodes over WebSocket read the header. A hot reload that changes it runs one poll at once, applies to new connections and keeps the open ones.
real_ip_fromarray of stringsdepends[]The reverse proxies trusted to set real_ip_header, as CIDRs such as "127.0.0.1/32" or "::1/128", like nginx's set_real_ip_from. A bare address is a single host. Set host bits ("192.0.2.1/24") or a value that is not a CIDR fail with real_ip_from "<value>": <reason>. Needed with real_ip_header, and only with it: set alone, it fails with real_ip_from is set without real_ip_header. A hot reload that changes it runs one poll at once, applies to new connections and keeps the open ones.
ban_max_failuresu32no30Under enable_device_limit: ban a client IP once this many of its authentications fail within ban_window_secs. An IPv6 client's whole /64 counts and is banned as one IP, and an IPv4-mapped address counts as its IPv4 address. 0 bans no one. Counts failures on VMess, VLESS, Trojan, Shadowsocks and AnyTLS nodes. sss streams refused before authentication and connections a REALITY node passes to its cover site are not counted; Hysteria 2 connections are neither counted nor refused.
ban_window_secsu64no120The window, in seconds, in which ban_max_failures failures ban an IP. A window that has passed starts the count afresh.
ban_secsu64no300How long a ban lasts, in seconds. A banned IP's new connections are dropped before the TLS handshake; its open connections continue.
carrier_max_failuresu32no8gRPC nodes only: close a gRPC connection once this many of its streams in a row fail to authenticate. A stream that authenticates resets the count. 0 never closes one. Independent of enable_device_limit.
handoff_dirpathno—Also take the TCP connections that a relay running on the same host accepted for this node and hands over, on a Unix socket of the node's own in this directory. A node on every address (listen_ip 0.0.0.0 or ::) names it after its port, <handoff_dir>/<port>.sock, such as /run/katana/handoff/443.sock for a node on port 443. A node on one address puts the address first, <handoff_dir>/<listen_ip>-<port>.sock, such as /run/katana/handoff/203.0.113.5-443.sock, with an IPv6 address as katana prints it, such as 2001:db8::1-443.sock; so nodes on one port and different addresses get different sockets. The relay sends each connection with a PROXY protocol v2 header that names its client, and katana serves it as if its own listener had accepted it. Every stream node, that is every node type but Hysteria 2, gets a socket; a Hysteria 2 node gets none. The socket has mode 0660, so only its owner and its group can connect. A missing directory is created, mode 0750 and in handoff_group; a directory that already exists is left as it is. Unset, no socket is bound. Write an absolute path short enough that the directory, a / and the node's socket name at port 65535, the longest any port gives, fit in the 107 bytes a Unix socket's path may have: at most 96 bytes on a node on every address, and less on a node on one address, such as 84 bytes with listen_ip = "203.0.113.5". A relative path fails with handoff_dir "<value>" must be an absolute path, a longer one with handoff_dir "<value>" is too long: with "<name>" in it, a socket's path would pass the 107 bytes a Unix socket's path may have, where <name> is that longest name, such as 65535.sock. katana checks it on every node, at --test, at start and on a reload. A hot reload that changes it runs one poll at once, which binds, moves or removes the socket and keeps every open connection, the handed-over ones included.
handoff_groupstringno—The group the handoff sockets, and a directory katana creates for them, are given: the relay's, so that it can connect. Write the group's name as /etc/group lists it, such as "relay"; the relay's user must be in the group. katana looks the name up in /etc/group itself, not through NSS, at --test, at start, on a reload and at every poll, and refuses a name it does not find there with handoff_group "<value>" is not a group in /etc/group. Needs handoff_dir: set alone, it fails with handoff_group is set without handoff_dir. Unset, the sockets keep katana's own group. Unless katana runs as root, its own user must be in the group too, because a process can give a file only a group it belongs to. A hot reload that changes it runs one poll at once, which binds the socket again with the new group and keeps every open connection. The directory keeps the group it has, even one katana created, so give it the new group yourself.
certtabledepends{}The listener certificate, written as [node.controller.cert]. Required with mode = "file" for Trojan and Hysteria 2 nodes, and for V2ray nodes the panel marks as TLS. katana reads the files again at every poll, so a renewed certificate reaches new connections at the next poll while open ones continue. A hot reload that changes any of its keys drops every connection on the node.

At startup, a node fetches its settings and users from the panel, loads its audit rules, and builds and binds its listener. If any of that fails, the node tries again until it succeeds (When a node fails to start). Once the node is up, a single timer ticks every update_periodic seconds. Each tick runs one cycle, in this order:

  1. Fetch the node settings and the user list. A failed fetch keeps the last answer that worked.
  2. Refresh the audit rules, unless disable_get_rule = true.
  3. Apply the changes. A new user list, new speed limits and new audit rules apply in place, and open connections continue; a new rate reaches them at once. A new port, transport, TLS setting or protocol drops every connection on the node.
  4. Report each user’s traffic, unless disable_upload_traffic = true. On helium the same report carries the client addresses users connected from, when enable_device_limit is on.

The first cycle runs one full period after the node is up, not immediately. A config edit that katana accepts and that touches [node.api], enable_mtls, a listener setting (listen_ip, [node.controller.cert], disable_sniffing, [node.hysteria] or [node.route]), disable_vmess_clock_check, the device-limit and ban keys, the real-IP keys or the handoff keys also runs one cycle at once, without moving the timer; What an edit to a running node does lists the details. With the default of 60, a user you add in the panel can take up to a minute to be admitted, and traffic reaches the panel in batches of up to a minute. A shorter period makes changes arrive sooner and sends more requests to the panel. katana does not read the push and pull intervals a panel publishes.

When katana stops on SIGINT or SIGTERM, each node closes its listener and every connection at once, and then reports its remaining traffic once more.

listen_ip is the address only; the port always comes from the panel. katana binds UDP for Hysteria 2 nodes, and TCP for every other node type.

0.0.0.0, the default, means every address, IPv6 included, as it does for Xray and XrayR. Where this host’s IPv6 sockets also accept IPv4, which is Linux’s default (net.ipv6.bindv6only = 0), katana binds one [::] socket that serves both families, and the node logs node 1: listening on [::]:443. Where they do not, katana binds 0.0.0.0 and serves IPv4 only; with bindv6only set, it says so once:

WARN katana::lower::inbound: IPv6 sockets here take IPv6 alone (net.ipv6.bindv6only), so listen_ip 0.0.0.0 serves IPv4 only

Any other address is bound as written. "::" listens on IPv6 and, with bindv6only = 0, on IPv4 as well.

katana names each node’s listener with a tag built from the node type, the listen address as written and the port: V2ray_0.0.0.0_443, Trojan_203.0.113.10_8443, Shadowsocks_::_10086 or Hysteria2_0.0.0.0_443; the other types start with AnyTLS, Socks, Http and Sss. A VLESS node’s tag also starts with V2ray. The tag appears in the runtime’s messages about the listener, such as a failed bind: inbound V2ray_0.0.0.0_443: binding <address> failed: …. Most node log lines use the node ID instead: node 1: listening on [::]:443.

A relay running on the same host as katana can hand the TCP connections it accepted for a node over to katana, which then serves each client’s own connection. Set handoff_dir, and every stream node (every node type but Hysteria 2) also listens on a Unix socket of its own in that directory, named after its port:

/etc/katana/config.toml
[node.controller]
handoff_dir = "/run/katana/handoff" # node on port 443: /run/katana/handoff/443.sock
handoff_group = "relay" # the group the relay runs as

The node then logs both places it listens:

INFO katana::manager::node: node 1: listening on [::]:443, and for handed-over connections on /run/katana/handoff/443.sock

A node that listens on one address rather than all of them puts that address in front of the port, so nodes on one port and different addresses get different sockets:

listen_ip Socket of a node on port 443
0.0.0.0 (the default) or :: /run/katana/handoff/443.sock
203.0.113.5 /run/katana/handoff/203.0.113.5-443.sock
2001:db8::1 /run/katana/handoff/2001:db8::1-443.sock

An IPv6 address appears as katana prints it, in its shortest form. The name follows listen_ip, so an edit to listen_ip can move the socket: point the relay at the path in the new listening on line.

  • The relay sends each connection over the socket together with a PROXY protocol v2 header that names the client. katana serves the connection exactly as one its TCP listener accepted, through the same transport, TLS and protocol, and takes its client from the header: the device limit, the IP ban and helium’s reports all see that address. A header with the LOCAL command leaves the address the connection itself comes from.
  • The socket has mode 0660 and the group handoff_group, or katana’s own group without it, so only the relay’s group can connect. A directory katana creates for the sockets gets mode 0750 and the same group. Deployment lists what the relay’s user and katana’s user need, and how to give katana a writable directory under the systemd unit.
  • A Hysteria 2 node runs on UDP and gets no socket.
  • The TCP port keeps serving clients that connect directly. Connections on the port and on the socket count together against the node’s connection guardrails.

A hot reload that adds, moves or removes the socket keeps every connection, handed-over ones included.

By default, katana reads the TLS SNI or HTTP Host from the first bytes of each TCP flow and passes it to the audit rules and the routing rules. A client that connects to an IP address can then still match an audit rule, or a domain_suffix or geosite rule. Sniffing never changes where katana connects: the flow still goes to the address the client asked for. UDP packets are not sniffed.

Set disable_sniffing = true if your audit and routing rules should see only the destination the client named.

[node.controller.cert] gives the listener its certificate. katana never uses the certificate settings a panel publishes and has no ACME client, so you obtain and renew certificates yourself and point katana at the files.

KeyTypeRequiredDefaultDescription
modestring (enum)depends"none""none" (no certificate) or "file" (read cert_file and key_file). Case-sensitive. "file" is required for every node that uses TLS; without it a stream node fails with TLS node requires cert.mode = "file" and a Hysteria 2 node with hysteria2 node requires cert.mode = "file". The ACME modes "dns", "http" and "tls" are refused on every stream node, TLS or not: node requests kernel-unsupported feature: ACME cert mode "dns"; on a Hysteria 2 node they fail like any value other than "file". Any other value behaves like "none" on a stream node. A REALITY node reads nothing from this table: it needs no certificate, and none of these checks apply to it.
cert_filepathdepends""PEM certificate chain: the server certificate first, then any intermediates (a fullchain.pem). Required with mode = "file"; if it or key_file is empty, a TLS or Hysteria 2 node fails with TLS node requires cert.cert_file and cert.key_file. katana reads it when the node starts and again at every poll, so a renewed certificate reaches new connections at the next poll.
key_filepathdepends""PEM private key matching cert_file. Required with mode = "file". Read at the same moments as cert_file; a key that does not match the certificate fails the node's build.
reject_unknown_sniboolnofalseNot implemented, so true is refused rather than silently ignored: the node fails with node requests kernel-unsupported feature: cert.reject_unknown_sni. Leave it false.

Which nodes need mode = "file":

Node TLS Needs a certificate
V2ray (VMess or VLESS) As the panel says: UniProxy tls = 1, helium security of type tls. UniProxy tls = 2 and helium security of type reality are REALITY, on a VLESS node only Only when the panel turns TLS on. A REALITY node needs none
Trojan Always Yes
Shadowsocks As the panel says: UniProxy tls = 1, helium security of type tls Only when the panel turns TLS on
sss (helium only) As the panel says: security of type tls Only when the panel turns TLS on
AnyTLS Always Yes
SOCKS, HTTP Always; a node without TLS is refused Yes
Hysteria 2 Always, inside QUIC Yes

katana reads the certificate and key when the node starts and again at every poll. For a node whose node_type is a Hysteria 2 value, --test reads them as well; for every other node, a helium Hysteria 2 node included, it does not. A TLS stream listener accepts TLS 1.2 and 1.3; QUIC always uses TLS 1.3.

One katana process can serve any number of nodes. Each [[node]] block gets its own panel client, listener, user list, traffic counters, audit rules and routing table, and its own copies of the outbounds and the [dns] resolver, built from the definitions in the file. A WireGuard outbound that several nodes route to therefore runs one tunnel per node with the same key, which katana warns about; see Several nodes in one file.

This file serves two nodes of the same panel from one machine, each on its own address:

/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"
[node.controller]
listen_ip = "203.0.113.10"
[node.controller.cert]
mode = "file"
cert_file = "/etc/katana/fullchain.pem"
key_file = "/etc/katana/privkey.pem"
[[node]]
panel_type = "NewV2board"
[node.api]
host = "https://panel.example.com"
node_id = 2
key = "replace-with-the-panel-key"
node_type = "Trojan"
speed_limit = 50
[node.controller]
listen_ip = "203.0.113.11"
disable_sniffing = true
[node.controller.cert]
mode = "file"
cert_file = "/etc/katana/fullchain.pem"
key_file = "/etc/katana/privkey.pem"

Keep these rules in mind:

  • Ports come from the panel. Two TCP nodes, or two Hysteria 2 nodes, can share a port only if they listen on different specific addresses; 0.0.0.0 and :: overlap with every address. When two nodes collide, the one that binds second fails with inbound <tag>: binding <address> failed: Address already in use (os error 98). A TCP node and a Hysteria 2 node can use the same port number, because one binds TCP and the other UDP.
  • Nodes fail independently. A node that cannot start does not stop the others, and katana keeps running while that node retries.
  • Give each block a distinct identity (see below).

katana watches its configuration file and applies edits without a restart. To do that, it has to decide whether each [[node]] in the new file is a node that is already running. It matches on five values, the node identity. Together they name one node in the panel:

Part Compared as
panel_type Case-insensitive, so NewV2board and newv2board are the same node. NewV2board and V2board are different values
[node.api].host Exactly as written, so adding a trailing slash counts as a change
[node.api].node_id Number
[node.api].key Exactly as written
The node type katana asks the panel for NewV2board / V2board: vless for a V2ray, Vmess or Vless node with enable_vless = true, otherwise node_type lowercased. Helium has none, because helium finds a node by its ID alone

A UniProxy panel finds a node by its ID and the type it is asked for, so the same ID asked as vmess and as vless is two nodes there, each with its own users and traffic. That is why the requested type is part of the identity on those panels.

What the match means:

  • Same identity: it is the same node. It keeps its traffic counters and audit rules, and receives the other edits in place. An edit to [node.api], to enable_mtls or to [node.hysteria] gives it a new panel client; some edits drop its connections; the rest do not touch connections at all.
  • Identity gone from the file: katana stops the node. It closes the listener, which drops its connections, and reports the node’s remaining traffic.
  • New identity: katana starts a new node from scratch, exactly as at startup.

Changing any identity field is therefore a remove followed by an add. The old node stops first, so the new one can bind the same port. The log shows each step, naming the node by panel type, host, ID and, on UniProxy panels, the requested type (never the key). Turning on enable_vless for a V2ray node on Xboard, for example, logs:

INFO katana::runtime: reload: removing node newv2board@https://panel.example.com#1/v2ray
INFO katana::runtime: reload: added node newv2board@https://panel.example.com#1/vless

The name leaves out only the key, so after a key change both lines show the same name. A helium node’s name has no type: helium@https://panel.example.com#1. An edit that keeps the identity logs reload: reconfigured node … instead.

You change Effect on a running node
panel_type (other than its case), host, node_id or key; on NewV2board / V2board, also a node_type or enable_vless change that changes the requested type The node is replaced: stopped, then started from scratch
listen_ip, disable_sniffing, or any key in [node.controller.cert] Applied at once, dropping every connection on the node
node_type, enable_vless, speed_limit, rule_list_path or timeout in [node.api], or enable_mtls, when the node is not replaced Applied at once, without a restart: katana builds a new panel client, which reads the node settings and users in full. Connections drop only if that answer changes the protocol or transport, as an enable_vless edit on a node_type = "vless" node does. On helium, a reload that sets node_type or enable_vless is refused instead
disable_vmess_clock_check, enable_device_limit, ban_max_failures, ban_window_secs, ban_secs, carrier_max_failures, real_ip_header or real_ip_from Applied at once to new connections; open connections are kept. Only a WebSocket node reads real_ip_header and real_ip_from
handoff_dir or handoff_group Applied at once: the node binds its handoff socket, binds it again at the new path or with the new group, or removes it. Every open connection is kept, handed-over ones included
update_periodic The timer restarts; the next cycle runs one full new period later
disable_upload_traffic Applied from the next cycle
send_ip or [node.api].device_limit Nothing; these keys have no effect

An edit in the second to fifth rows also runs one poll cycle right away, without waiting for the timer: the node asks the panel with the new values, refreshes its audit rules, applies the answer (dropping connections where the row says so) and reports traffic. A speed_limit, rule_list_path or enable_mtls edit keeps every connection. A new rate applies at once, to flows already open as well; new rules apply to the flows opened after the edit. On helium, a reload that sets node_type or enable_vless is refused. A node that is still retrying its first start stores the edit and tries again at once with the new values.

katana checks an edit before it applies any of it. Every node the edit adds or changes must build: its panel client, its outbounds, [dns] and its routing table; its real_ip_header and real_ip_from must be set together and valid; and its handoff_dir must be an absolute path short enough for the node’s socket, at most 96 bytes on a node on every address and less on one address, with a handoff_group that /etc/group lists. If one does not, for example because of panel_type = "SSpanel", an unknown panel_type or node_type, a node_type on a helium node, a rule that names a missing outbound, real_ip_header without real_ip_from, or a handoff_group without handoff_dir, katana refuses the whole reload and every node keeps running as it was. The log names the node: reload: node <name>: <error>; keeping current config.

[node.route] and [node.hysteria] edits are covered on their own pages, and Hot reload covers the rest of the file.

A node’s first start has four steps: fetch the node settings, fetch the users, load the audit rules, and build the node and bind its listener. No failure ends the node. When a fetch, the build or the bind fails, the node logs the reason at ERROR, waits, and starts again from the first step. The wait is 1 second after the first failure and doubles after each one, up to 60 seconds, or up to update_periodic if that is shorter. An edit to the node’s [[node]] block cuts the wait short: the node applies it and tries again at once, because the edit may well be the fix.

stateDiagram-v2
  [*] --> Starting: katana starts, or a reload adds the node
  Starting --> Serving: settings, users and listener up
  Starting --> Down: a fetch fails, the panel's node is refused, or the listener fails
  Down --> Starting: the wait ends, or an edit reaches the node
  Serving --> Serving: poll cycle every update_periodic seconds
  Serving --> Stopped: SIGINT, SIGTERM, or removed by a reload
  Down --> Stopped: SIGINT, SIGTERM, or removed by a reload
  Stopped --> [*]

Each failed attempt logs one line, node <id>: <reason>; retrying in <N>s, where <N> is the wait before the next attempt:

Step What goes wrong Log line (level ERROR)
Fetch node settings Panel unreachable, a timeout, or an HTTP error status, such as a wrong key or an unknown node ID on Xboard node 1: node_info failed: GET /api/v1/server/UniProxy/config; retrying in 1s (helium: GET config)
Fetch node settings The answer is not a node config katana can use, for example an HTML page served with status 200 because host points at the wrong site, or a redirect node 1: node_info failed: parse UniProxy config response: expected value at line 1 column 1; retrying in 1s (helium: parse helium config response: …)
Fetch node settings On Xboard and V2board, katana refuses the node the answer describes: a feature it does not serve, a port outside 1 to 65535, or a setting it cannot use node 1: node_info failed: parse UniProxy config response: node requests kernel-unsupported feature: httpupgrade transport; retrying in 1s, … parse UniProxy config response: server_port 0 is not a port (1 to 65535); …
Fetch node settings The panel answers 304 Not Modified although katana asked without a cached tag node 1: panel returned no node info; retrying in 1s
Fetch users The same request errors as for the node settings, on the user-list request node 1: user_list failed: …; retrying in 1s
Fetch users The panel answers 304 Not Modified although katana asked without a cached tag node 1: panel returned no user list; retrying in 1s
Build the node and bind A certificate problem, an ACME cert.mode, or a failed bind node 1: initial start failed: TLS node requires cert.mode = "file"; retrying in 1s, … node requests kernel-unsupported feature: ACME cert mode "dns"; …, … No such file or directory (os error 2); …, … inbound V2ray_0.0.0.0_443: binding <address> failed: Address already in use (os error 98); …

Both fetches are required: a node does not come up until it has its settings and its user list, so a failed user-list fetch is retried like any other failed step. The number after retrying in grows with each failure: 1s, 2s, 4s, and so on up to the cap. A transient cause, such as a panel that is restarting, DNS that is not answering yet, or a port still held by the process this katana replaces, therefore clears on its own. For a cause in the configuration, fix it and save the file; for one outside it, such as a port held by another program, fix it and the node comes up at its next attempt. Either way, you do not need to restart katana. Until the node comes up, it binds nothing and reports no traffic. katana keeps serving its other nodes. If the failing node is the only one, the process runs with nothing listening, so a service manager still reports it as active; watch for these log lines.

Once a node has started, failures are not final either:

  • A failed fetch during a poll logs a warning, such as node 1: node_info: GET /api/v1/server/UniProxy/config, and the node keeps the last settings and users that worked.
  • A poll whose node settings katana refuses, such as a port outside 1 to 65535 or a transport it does not serve, counts as a failed fetch and logs the reason, node 1: node_info: parse UniProxy config response: …: the node keeps its last settings, and its users still follow the panel.
  • A change that cannot be applied is tried again at the next cycle.

To see what the panel answers, send the same request by hand from the node’s machine and look at the status and body:

Terminal window
curl -sS -H 'Accept: application/json' -w '\nHTTP %{http_code}\n' \
'https://panel.example.com/api/v1/server/UniProxy/config?node_id=1&node_type=vmess&token=replace-with-the-panel-key'

Use the node_type katana sends: your value lowercased, or vless when a V2ray, Vmess or Vless node has enable_vless = true. Xboard answers every error with JSON and an error status, which katana logs as the failed GET:

Status Message Cause
422 Invalid token key does not match the panel’s server token
422 Invalid node type specified A node_type Xboard does not know, such as hy2
400 Server does not exist No node with this ID and type

The command puts the key in your shell history. Clear that entry afterwards if the machine is shared.

Message Cause and fix
configuration error: node 1: unknown panel_type "" panel_type is missing. Add panel_type = "NewV2board" or "Helium" to the [[node]] block, not to [node.api].
configuration error: node 1: panel_type "SSpanel" is not supported: katana serves the NewV2board and Helium panels katana 6.0.0 removed SSPanel. Serve the node from an Xboard, V2board or helium panel; see Upgrading to katana 6.
configuration error: node 1: unknown panel_type "xboard" Use NewV2board (or V2board) for Xboard.
configuration error: node 1: unknown node_type "" [node.api].node_type is missing. Every panel type but Helium needs it.
configuration error: node 1: unknown node_type "vmess2" Use one of the values in the node_type row above.
configuration error: node 1: [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: [node.api] enable_vless or a [node.hysteria] key other than congestion in the same way. Remove the key.
configuration error: node 1: 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.
configuration error: config defines no [[node]] entries The file has no [[node]] block.
configuration error: node 1: hysteria2 node requires cert.mode = "file" A Hysteria 2 node needs a certificate. Set mode = "file", cert_file and key_file.
node 1: initial start failed: TLS node requires cert.mode = "file"; retrying in <N>s The node is a Trojan node, or the panel marks it as TLS. Add the certificate table with mode = "file".
node 1: initial start failed: TLS node requires cert.cert_file and cert.key_file; retrying in <N>s mode = "file" is set but a path is empty.
node 1: initial start failed: node requests kernel-unsupported feature: ACME cert mode "http"; retrying in <N>s katana has no ACME client. Use mode = "file" with certificates you renew yourself.
node 1: node_info failed: parse UniProxy config response: node requests kernel-unsupported feature: VLESS flow "xtls-rprx-direct"; retrying in <N>s katana serves only the flow xtls-rprx-vision, over REALITY. Change the flow in the panel. Troubleshooting lists every reason katana refuses a node with.
node 1: node_info failed: parse UniProxy config response: server_port 0 is not a port (1 to 65535); retrying in <N>s The panel gives the node no port, or one outside 1 to 65535. Set the node’s port in the panel.
node 1: initial start failed: inbound <tag>: binding <address> failed: Address already in use (os error 98); retrying in <N>s Another node or program holds the port on that address. Change listen_ip or the panel’s port.
node 1: initial start failed: inbound <tag>: binding <address> failed: Cannot assign requested address (os error 99); retrying in <N>s listen_ip is not an address of this machine.
configuration error: node 1: handoff_group "relay" is not a group in /etc/group /etc/group has no such group. Use the group the relay runs as, by name.
configuration error: node 1: handoff_dir "<dir>" is too long: with "65535.sock" in it, a socket's path would pass the 107 bytes a Unix socket's path may have The directory leaves no room for the node’s socket name at the highest port, which the message quotes; on a node on one address that name includes the address. Use a shorter directory.
node 1: initial start failed: inbound <tag>: binding handoff:<path> failed: …; retrying in <N>s The handoff socket could not be bound, and the node does not come up without it. Permission denied or Read-only file system means katana cannot write to the directory; Operation not permitted usually means katana’s user is not in handoff_group. See Handoff sockets.

The node keeps retrying after each node_info failed or initial start failed line. Once you fix the cause, it comes up at its next attempt, or at once if the fix is an edit to its [[node]] block, without a restart. Troubleshooting collects the errors from every part of katana.