From 50bed1e67a4b12a14132ae649ca91019472573ce Mon Sep 17 00:00:00 2001 From: WofWca Date: Sat, 1 Mar 2025 23:44:03 +0400 Subject: [PATCH] refactor: docstring for checkIsRelayURLAcceptable Related: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40378. --- proxy/lib/snowflake.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index 18a321a..7bd9c15 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -688,7 +688,13 @@ func (sf *SnowflakeProxy) runSession(sid string) { } } -// Returns nil if the relayURL is acceptable +// Returns nil if the relayURL is acceptable. +// This is a pure function. +// If the hostname in the `relayURL` is not an IP address +// (but a name instead, e.g. `localhost`), +// this function will _not_ perform a DNS request to figure out +// if the name resolves to a private IP address, +// i.e. the private / public check will effectively be skipped. func checkIsRelayURLAcceptable( allowedHostNamePattern string, allowPrivateIPs bool,