Skip to content
Snippets Groups Projects
Commit 26a87f9d authored by Dreamacro's avatar Dreamacro
Browse files

Fix: `redir-host` mode crash

parent 8da19e81
No related branches found
No related tags found
No related merge requests found
......@@ -107,15 +107,15 @@ func (t *Tunnel) resolveIP(host string) (net.IP, error) {
return t.resolver.ResolveIP(host)
}
func (t *Tunnel) needLookupIP() bool {
return t.hasResolver() && t.resolver.IsMapping()
func (t *Tunnel) needLookupIP(metadata *C.Metadata) bool {
return t.hasResolver() && t.resolver.IsMapping() && metadata.Host == "" && metadata.IP != nil
}
func (t *Tunnel) handleConn(localConn C.ServerAdapter) {
defer localConn.Close()
metadata := localConn.Metadata()
if t.needLookupIP() {
if t.needLookupIP(metadata) {
host, exist := t.resolver.IPToHost(*metadata.IP)
if exist {
metadata.Host = host
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment