Skip to content

Upgrading to katana 4

katana 4 runs every node on the Etemenanki runtime instead of katana’s own serving code. The panels, the protocols and the config file stay the same, so a node upgrades in place: the same binary names, the same systemd unit and the same config.toml. What changes is how some things behave once the node runs, and a few of those changes are visible to your users or your billing.

This page lists those changes for operators moving from katana 3.0.x to 4.x; it describes 4.10.0. Each section says what was different in 3.x and links to the page that explains the 4.x behaviour in full. The restart itself follows the procedure in Deployment.

katana 4 reads the same keys as katana 3 and adds a few, so a 3.x file parses unchanged. The additions are endpoint_address_family on a WireGuard [[outbound]]; disable_vmess_clock_check (4.2), and enable_device_limit, ban_max_failures, ban_window_secs, ban_secs and carrier_max_failures (4.4) in [node.controller]; up_mbps, down_mbps, ignore_client_bandwidth and congestion in [node.hysteria] (4.6); real_ip_header and real_ip_from in [node.controller] (4.7); and handoff_dir and handoff_group in [node.controller] (4.8). katana 4.5 also adds panel_type = "Helium", 4.9 adds the node_type values AnyTLS, Socks and Http and serves REALITY with Vision on VLESS nodes, and 4.10 adds node_type = "sss". A few keys behave differently, as the sections below describe, and --test now builds each node’s outbounds, [dns] and routes. Run the new binary’s --test on each file before you restart anything, as the upgrade procedure does; it also prints the new WireGuard warning described below, if it applies to your file.

  1. Check the IPv6 side of the firewall. On a dual-stack host, listen_ip = "0.0.0.0", the default, now accepts IPv6 clients as well. See Nodes listen on IPv6 too.

  2. Move audit rules for IP addresses into routing. Audit rules now match domain names only. See Audit rules match domain names only.

  3. Give each node its own WireGuard key. Every node that routes to a WireGuard outbound now brings up its own tunnel. See Every node builds its own outbounds.

  4. Tell whoever reads the panel’s figures. The same transfer reports more bytes than before. See Traffic figures rise.

  5. Update debug log filters. A RUST_LOG or [log].level that names katana::serve or katana::manager::proxy no longer matches anything. See Log lines.

katana 3 counted the payload each flow moved through an outbound. katana 4 counts each connection’s proxy protocol stream, including the protocol’s own handshake, headers and framing. For the same transfer, the panel therefore shows a little more than before:

katana 3 katana 4
Protocol overhead (headers, framing, encryption, padding) Not counted Counted
A multiplexed connection Each sub-flow’s payload The whole connection, mux frames included
Hysteria 2 Each proxy stream’s and datagram’s payload The bytes of the user’s QUIC connection
A flow sent to block or stopped by an audit rule Not counted The connection’s bytes are counted

TLS records, WebSocket and gRPC framing and TCP/IP headers are still not counted. Traffic reporting describes what is counted.

katana 3 tested audit rules against the destination as the client addressed it, an IP address or a name, and refused a matching flow. katana 4 turns the rules into the node’s first routes:

  • A rule is tested against the domain name, in lower case: the name the client asked for, or the name sniffed from the flow’s first bytes. A sniffed name did not count in katana 3.
  • A flow addressed by IP with no sniffed name is never matched. A rule written for an IP address has no effect; write a cidr or geoip rule that routes to block instead.
  • A matching flow goes to a blackhole: a TCP connection is answered as if connected and then ends without data, and a UDP datagram is dropped.
  • Because the audit rules run before [node.route], a flow that a route would also block is recorded as a hit.
  • Tags that start with audit# are reserved for these routes, so an [[outbound]] cannot use one.

See Destination audit.

In katana 3, listen_ip = "0.0.0.0" bound an IPv4 socket. katana 4 binds it as [::] wherever an IPv6 socket on the host also takes IPv4, as XrayR and Xray do, so the node serves IPv4 and IPv6 clients on the same port. The log shows the new address:

INFO katana::manager::node: node 1: listening on [::]:443

Where the host sets net.ipv6.bindv6only, katana keeps an IPv4 bind and logs IPv6 sockets here take IPv6 alone (net.ipv6.bindv6only), so listen_ip 0.0.0.0 serves IPv4 only. A specific address binds as written. The node tag in log lines still shows listen_ip as written, for example V2ray_0.0.0.0_443.

Check the IPv6 rules of the host firewall and any cloud security group, and make sure no other program holds the same port on IPv6. See Listen address and node tag.

Speed-limit changes reach open connections

Section titled “Speed-limit changes reach open connections”

In katana 3, a new limit applied only to flows opened after the change. In katana 4 it reaches every flow of the user, open ones included, within about a second of katana applying it: at the next poll for a panel change, at once for a speed_limit saved in the file. Nobody is disconnected. See Speed limits.

katana 4 checks every node that a save adds or changes before it applies anything, and after an [[outbound]] or [dns] edit it checks every node. If one does not build, the whole save is refused with reload: node <name>: <error>; keeping current config, and every node keeps running as it was. In katana 3, some of these edits were refused by the node alone, and the rest of the save still applied.

Edit katana 3 katana 4
[dns] alone Applied only together with the next [[outbound]] edit Applied at once. Every node builds a new resolver and drops all its connections
[[outbound]] Rebuilt one shared outbound pool Every node builds its outbounds again and drops all its connections. The log says reload: outbound pool rebuilt
[node.route] with a rule that names a missing outbound The node kept its old routes; the rest of the save applied The whole save is refused
An [[outbound]] that does not build reload: bad outbounds, keeping current config: … reload: node <name>: …; keeping current config

See Hot reload.

katana 3 read a node’s certificate only when it built the node’s listener, so a renewed certificate took a restart. katana 4 reads the certificate and key again at every poll: new connections get the renewed certificate within update_periodic seconds, and open connections continue. A deploy hook that restarts katana still works, but it now drops connections for nothing. Replace it with one that only puts the files in place; see Certificate renewal.

In katana 3, one process built one outbound pool and one resolver, and every node shared them. In katana 4, [[outbound]] and [dns] are still written once, but every node builds its own copy of each outbound and its own resolver, with its own cache.

  • WireGuard. An outbound that several nodes route to becomes one tunnel per node, all with the same key, and a WireGuard peer keeps only one session per key. katana warns about it at startup, in --test and on every reload: wireguard outbound <tag> is routed to by N nodes (…): each brings up its own tunnel with the same key, and the peer keeps only one of them at a time. Give each node its own key and its own [[outbound]].
  • The WireGuard endpoint named by a domain in server is resolved with the node’s [dns] resolver, not the system resolver. The new endpoint_address_family key picks which of its address families to dial.
  • global_padding on a VMess outbound has no effect: the VMess client always pads.

See Outbounds.

katana 4 skips each user it cannot admit and serves the rest, with a warning that names the user ID and the reason: uuid is not a valid UUID, uuid is empty, listed twice, shares its credential with user <first>, shadowsocks-2022 key too short (< N) or its name holds ':'. katana 3 logged only the first of these. See Users.

The per-node connection limits are fixed in the code, as before, but higher:

Limit katana 3 katana 4
Live connections per stream node 65,536 4,194,304
Hysteria 2 QUIC connections per node 4,096 262,144
Hysteria 2 streams and UDP sessions per node 65,536 4,194,304

A refused connection is logged at debug by the runtime. Connection guardrails lists every limit, and Deployment explains why the host’s own limits matter more.

Some lines are gone, some changed their wording, and some are new. The targets changed too: per-connection lines now come from the runtime, etemenanki_supervisor, so a filter such as info,katana::serve=debug becomes info,etemenanki_supervisor=debug.

katana 3 katana 4
node <tag>: N inbound handshake failures in the last 1s (…) Removed. Each failed connection is logged at debug by etemenanki_supervisor.
DEBUG katana::serve: inbound handshake failed: … DEBUG etemenanki_supervisor::serve: <protocol> connection from … ended: …
node N: initial start failed: Address already in use (os error 98) node N: initial start failed: inbound <tag>: binding <address> failed: Address already in use (os error 98)
failed to build outbounds: … at startup node N: … for each node, then no nodes could be started
node N: build router: … node N: route references unknown outbound … or node N: building route failed: …
node N: rebuild failed: …, node N: route rebuild failed, keeping current: …, reload: bad outbounds, keeping current config: …, hysteria listener failed: … Removed. A save that does not build is refused as a whole; see Config reloads are all or nothing.
skipping user N: uuid is not a valid UUID (target katana::manager) The same text, now from katana::lower, with more reasons
None reload: outbound pool rebuilt, the WireGuard and bindv6only warnings above, audit rule <id> skipped: …, node N: audit missed <n> flow events

Troubleshooting lists every line with its cause.

A katana 3 binary reads a katana 4 config file unless the file uses one of the keys katana 4 added, listed in The config file carries over, which katana 3 rejects as unknown fields, a helium node, which it rejects as an unknown panel_type, or a node type katana 3 does not serve (AnyTLS, Socks, Http, sss). Remove those first, then follow Roll back. After the rollback, the 3.x behaviour on this page applies again: panel figures drop back, audit rules match IP addresses again, and 0.0.0.0 serves IPv4 only.