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
Copy file name to clipboardExpand all lines: README.md
+98-2Lines changed: 98 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Routes Minecraft client connections to backend servers based upon the requested
43
43
-mapping value
44
44
Comma or newline delimited or repeated mappings of externalHostname=host:port (env MAPPING)
45
45
-metrics-backend string
46
-
Backend to use for metrics exposure/publishing: discard,expvar,influxdb (env METRICS_BACKEND) (default "discard")
46
+
Backend to use for metrics exposure/publishing: discard,expvar,influxdb,prometheus (env METRICS_BACKEND) (default "discard")
47
47
-metrics-backend-config-influxdb-addr string
48
48
(env METRICS_BACKEND_CONFIG_INFLUXDB_ADDR)
49
49
-metrics-backend-config-influxdb-database string
@@ -74,9 +74,12 @@ Routes Minecraft client connections to backend servers based upon the requested
74
74
Send PROXY protocol to backend servers (env USE_PROXY_PROTOCOL)
75
75
-version
76
76
Output version and exit (env VERSION)
77
+
-webhook-require-user
78
+
Indicates if the webhook will only be called if a user is connecting rather than just server list/ping (env WEBHOOK_REQUIRE_USER)
79
+
-webhook-url string
80
+
If set, a POST request that contains connection status notifications will be sent to this HTTP address (env WEBHOOK_URL)
77
81
```
78
82
79
-
80
83
## Docker Multi-Architecture Image
81
84
82
85
The [multi-architecture image published at Docker Hub](https://hub.docker.com/repository/docker/itzg/mc-router) supports amd64, arm64, and arm32v6 (i.e. RaspberryPi).
@@ -353,6 +356,99 @@ From those logs, locate the `ngrokUrl` parameter from the "Listening" info log m
353
356
354
357
In the Minecraft client, the server address will be the part after the "tcp://" prefix, such as `8.tcp.ngrok.io:99999`.
355
358
359
+
## Webhook Support
360
+
361
+
Refer to [the usage section above](#usage) for `-webhook-*` argument descriptions.
362
+
363
+
### Sample connect event payloads
364
+
365
+
The following are sample payloads for the `connect` webhook events.
366
+
367
+
#### Successful player backend connection
368
+
369
+
```json
370
+
{
371
+
"event": "connect",
372
+
"timestamp": "2025-04-20T22:26:30.2568775-05:00",
373
+
"status": "success",
374
+
"client": {
375
+
"host": "127.0.0.1",
376
+
"port": 56860
377
+
},
378
+
"server": "localhost",
379
+
"player": {
380
+
"name": "itzg",
381
+
"uuid": "5cddfd26-fc86-4981-b52e-c42bb10bfdef"
382
+
},
383
+
"backend": "localhost:25566"
384
+
}
385
+
```
386
+
387
+
**NOTE** `client` refers to the machine where the Minecraft client is connecting from and is conveyed separately from the `player` starting a session. As seen below, the player information may not always be present, such as when the client is pinging the server list.
388
+
389
+
#### Successful server ping backend connection
390
+
391
+
**NOTE** the absence of `player` in this payload since the Minecraft client does not send player information in the server ping request.
392
+
393
+
```json
394
+
{
395
+
"event": "connect",
396
+
"timestamp": "2025-04-20T22:26:30.2568775-05:00",
397
+
"status": "success",
398
+
"client": {
399
+
"host": "127.0.0.1",
400
+
"port": 56396
401
+
},
402
+
"server": "localhost",
403
+
"backend": "localhost:25566"
404
+
}
405
+
```
406
+
407
+
#### Missing backend
408
+
409
+
In this the status is `"missing-backend"` since the requested server `invalid.example.com` does not have a configured/discovered backend entry.
410
+
411
+
```json
412
+
{
413
+
"event": "connect",
414
+
"timestamp": "2025-04-20T22:26:30.2568775-05:00",
415
+
"status": "missing-backend",
416
+
"client": {
417
+
"host": "127.0.0.1",
418
+
"port": 56891
419
+
},
420
+
"server": "invalid.example.com",
421
+
"player": {
422
+
"name": "itzg",
423
+
"uuid": "5cddfd26-fc86-4981-b52e-c42bb10bfdef"
424
+
},
425
+
"error": "No backend found"
426
+
}
427
+
```
428
+
429
+
#### Failed backend connection
430
+
431
+
In this case the `status` is `"failed-backend-connection"` indicating that a backend server was located but a connection could not be established from mc-router.
432
+
433
+
```json
434
+
{
435
+
"event": "connect",
436
+
"timestamp": "2025-04-20T22:26:30.2568775-05:00",
437
+
"status": "failed-backend-connection",
438
+
"client": {
439
+
"host": "127.0.0.1",
440
+
"port": 56905
441
+
},
442
+
"server": "localhost",
443
+
"player": {
444
+
"name": "itzg",
445
+
"uuid": "5cddfd26-fc86-4981-b52e-c42bb10bfdef"
446
+
},
447
+
"backend": "localhost:25566",
448
+
"error": "dial tcp [::1]:25566: connectex: No connection could be made because the target machine actively refused it."
0 commit comments