You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LeoMoeAPI keeps the old v3 WebSocket API as the default when no NextTrace API v4 token is available. To use the NextTrace API v4 HTTP GeoIP endpoint for the current shell session, run the setup command and paste your token:
643
+
644
+
```bash
645
+
# Token page:
646
+
# GET https://api.nxtrace.org/v4/api-tokens
647
+
648
+
nexttrace -x
649
+
```
650
+
651
+
`nexttrace -x` stores the token in temporary files: one scoped to the parent process ID, which is normally your current shell, and one same-user fallback file for wrapper commands such as `go run`. Later `nexttrace` commands first read the real `NEXTTRACE_API_V4_TOKEN`, then the parent-PID file, then the fallback file, and load the value into the process-local environment. The command does not write shell profiles, permanent environment variables, or `nt_config.yaml`.
652
+
653
+
With `NEXTTRACE_API_V4_TOKEN` set and the active provider still `LeoMoeAPI`, NextTrace queries `GET https://api.nxtrace.org/v4/ipGeo?ip=<ip>` with `X-NextTrace-Token: <token>`. The request has no JSON body. Successful responses are direct GeoIP JSON mapped to the normal output fields; quota metadata is exposed only in headers (`X-NextTrace-Quota-Remaining`, `X-NextTrace-Quota-Expires-At`, `X-NextTrace-Quota-Cost`, `X-NextTrace-Quota-Source`) and does not change the default output format. Error responses prefer `{"error":{"message":"..."}}`; known statuses include `400` for empty/illegal IP, `401` unauthorized, `429` quota exhausted, and `500` internal server error. NextTrace API v4 token failures do not fall back to the old v3 WebSocket API.
654
+
642
655
#### `NextTrace` supports mixed parameters and shortened parameters
643
656
644
657
```bash
@@ -708,6 +721,7 @@ NextTrace currently reads the following environment variables. For boolean switc
708
721
| --- | --- | --- |
709
722
|`NEXTTRACE_HOSTPORT`|`api.nxtrace.org`| Override the backend host or `host:port` used by LeoMoeAPI, tracemap, and FastIP flows. |
710
723
|`NEXTTRACE_TOKEN`| unset | Pre-supplied LeoMoeAPI bearer token; when present, token fetching via PoW is skipped. |
724
+
|`NEXTTRACE_API_V4_TOKEN`| unset | LeoMoeAPI NextTrace API v4 HTTP GeoIP token. When unset, NextTrace also checks the temporary token files written by `nexttrace -x`; if neither exists, LeoMoeAPI keeps using the old v3 WebSocket / PoW flow. |
711
725
|`NEXTTRACE_POWPROVIDER`|`api.nxtrace.org`| Select the PoW provider. The built-in non-default alias is `sakura`. |
712
726
|`NEXTTRACE_DEPLOY_ADDR`| unset | Default listen address for `--deploy` when `--listen` is not provided. |
ver:=parser.Flag("V", "version", &argparse.Options{Help: "Print version info and exit"})
1219
+
setupNextTraceAPIV4Token:=parser.Flag("x", "setup-api-v4-token", &argparse.Options{Help: "Store a session-only NextTrace API v4 token in a temporary file"})
1211
1220
speedMode:=registerSpeedFlag(parser)
1212
1221
naliMode:=registerNaliFlag(parser)
1213
1222
srcAddr:=parser.String("s", "source", &argparse.Options{Help: "Use source address src_addr for outgoing packets"})
0 commit comments