[GH-ISSUE #15] WireGuard error -22 #1

Open
opened 2026-10-13 21:04:46 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @LeonardoDaFrenze on GitHub (Jul 16, 2025).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-windows/issues/15

Summary

Amnezia‑for‑Windows drops the square‑brackets around IPv6 literals in the
Endpoint= field when it hands the value to WireGuard.
As a result WireGuard‑UAPI rejects the address with


IPC error -22: failed to set endpoint IPv6:65350: too many colons in address

and the tunnel never handshakes.

Environment

  • Amnezia Windows client version: 
  • WireGuard‑Windows (wintun) version: 0.14
  • OS: Windows 10 22H2 x64
  • Working client‑side config (redacted):
    [Interface]
    Address = 10.0.0.2/32, fd10:0:0:1::2/128
    PrivateKey = <redacted>
    
    [Peer]
    PublicKey  = <redacted>
    Endpoint   = [YOUR_IPV6_ADDRESS]:65350
    AllowedIPs = 0.0.0.0/0, ::/0
    

* Server listens and accepts connections on the same address/port from
  other WireGuard clients.

### Steps to Reproduce

1. Import the config above in AmneziaWG for Windows.

2. Click **Activate**.

3. Observe immediate failure; relevant log excerpt:

   ```
   ... peer(...) - UAPI: Updating endpoint
   IPC error -22: failed to set endpoint YOUR_IPV6_ADDRESS:65350:
   address YOUR_IPV6_ADDRESS:65350: too many colons in address
   ```

4. Replace `Endpoint` with an **IPv4** → connection
   succeeds, so the server/NAT/firewall path is fine. 
NOTE: **DNS hostname**  did not work too.

### Expected Behaviour

Amnezia should pass the exact string from `Endpoint=` (including
brackets) to WireGuard so the tunnel comes up.

### Actual Behaviour

Brackets are stripped, WireGuard’s `net.SplitHostPort()` detects

> too many colons in address
> and returns EINVAL (-22).

### References

* Go `net.SplitHostPort` requires `[IPv6]` when a port is present and
  emits the same error string ([[GitHub](https://github.com/golang/go/issues/37817?utm_source=chatgpt.com)][1]).
* RFC 3986/RFC 2732 specify brackets around IPv6 literals that carry a
  port suffix ([[IETF Datatracker](https://datatracker.ietf.org/doc/html/rfc3986?utm_source=chatgpt.com)][2], [[IETF Datatracker](https://datatracker.ietf.org/doc/html/rfc2732?utm_source=chatgpt.com)][3]).
* Other projects hit identical parse failure when brackets are lost
  (example issue: siderolabs/omni #495) ([[GitHub](https://github.com/siderolabs/omni/issues/495?utm_source=chatgpt.com)][4]).

NOTE: this explanation composed by chat gpt and may contain mistakes. the error happend when i tried to replace my server ipv4 with ipv6 in endpoint.
Originally created by @LeonardoDaFrenze on GitHub (Jul 16, 2025). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-windows/issues/15 ### Summary Amnezia‑for‑Windows drops the square‑brackets around IPv6 literals in the `Endpoint=` field when it hands the value to WireGuard. As a result WireGuard‑UAPI rejects the address with ``` IPC error -22: failed to set endpoint IPv6:65350: too many colons in address ```` and the tunnel never handshakes. ### Environment * Amnezia Windows client version: <fill in> * WireGuard‑Windows (wintun) version: 0.14 * OS: Windows 10 22H2 x64 * Working client‑side config (redacted): ```ini [Interface] Address = 10.0.0.2/32, fd10:0:0:1::2/128 PrivateKey = <redacted> [Peer] PublicKey = <redacted> Endpoint = [YOUR_IPV6_ADDRESS]:65350 AllowedIPs = 0.0.0.0/0, ::/0 ```` * Server listens and accepts connections on the same address/port from other WireGuard clients. ### Steps to Reproduce 1. Import the config above in AmneziaWG for Windows. 2. Click **Activate**. 3. Observe immediate failure; relevant log excerpt: ``` ... peer(...) - UAPI: Updating endpoint IPC error -22: failed to set endpoint YOUR_IPV6_ADDRESS:65350: address YOUR_IPV6_ADDRESS:65350: too many colons in address ``` 4. Replace `Endpoint` with an **IPv4** → connection succeeds, so the server/NAT/firewall path is fine. NOTE: **DNS hostname** did not work too. ### Expected Behaviour Amnezia should pass the exact string from `Endpoint=` (including brackets) to WireGuard so the tunnel comes up. ### Actual Behaviour Brackets are stripped, WireGuard’s `net.SplitHostPort()` detects > too many colons in address > and returns EINVAL (-22). ### References * Go `net.SplitHostPort` requires `[IPv6]` when a port is present and emits the same error string ([[GitHub](https://github.com/golang/go/issues/37817?utm_source=chatgpt.com)][1]). * RFC 3986/RFC 2732 specify brackets around IPv6 literals that carry a port suffix ([[IETF Datatracker](https://datatracker.ietf.org/doc/html/rfc3986?utm_source=chatgpt.com)][2], [[IETF Datatracker](https://datatracker.ietf.org/doc/html/rfc2732?utm_source=chatgpt.com)][3]). * Other projects hit identical parse failure when brackets are lost (example issue: siderolabs/omni #495) ([[GitHub](https://github.com/siderolabs/omni/issues/495?utm_source=chatgpt.com)][4]). NOTE: this explanation composed by chat gpt and may contain mistakes. the error happend when i tried to replace my server ipv4 with ipv6 in endpoint.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-windows#1
No description provided.