Commit 8c12626
authored
fix: prevent resolver from overwriting DNS cache hostname entries (#11)
When gost calls the resolver with a raw IP (e.g. from tun2socks),
LookupIP returns the IP itself. RegisterIPs then overwrites the
correct hostname entry (e.g. 160.79.104.10 -> api.anthropic.com)
with a self-referential mapping (160.79.104.10 -> 160.79.104.10).
This caused pending requests and logs to show raw IPs instead of
hostnames, worsening over time as each connection corrupted its
cache entry.
Skip cache registration when the host is already an IP address.1 parent 3d16189 commit 8c12626
1 file changed
+11
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | | - | |
49 | 54 | | |
50 | | - | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
0 commit comments