feat: retrieve client IP from header in config.toml

If the config.toml has defined a HTTP header to look for a remote IP,
that will be logged.  Otherwise, the socket address IP will be used.

closes: https://todo.sr.ht/~gheartsfield/nostr-rs-relay/47
This commit is contained in:
Greg Heartsfield
2022-11-04 18:05:01 -05:00
parent 1cf9d719f0
commit ae5bf98d87
3 changed files with 21 additions and 18 deletions
+5
View File
@@ -46,6 +46,11 @@ address = "0.0.0.0"
# Listen on this port
port = 8080
# If present, read this HTTP header for logging client IP addresses.
# Examples for common proxies, cloudflare:
#remote_ip_header = "x-forwarded-for"
#remote_ip_header = "cf-connecting-ip"
[options]
# Reject events that have timestamps greater than this many seconds in
# the future. Recommended to reject anything greater than 30 minutes