add debug log and ignore ip sni

master
dingjun 4 years ago
parent 09d7cd42cb
commit a55acea38f

@ -157,11 +157,23 @@ func serve(ctx context.Context, c net.Conn) {
forward(ctx, c, buf[:n], getDefaultDST())
return
}
// sni is ip address, ignore it, prevent dead loop
ip := net.ParseIP(servername)
if ip != nil {
glog.Debugf("sni %s, send to default", ip.String())
forward(ctx, c, buf[:n], getDefaultDST())
return
}
dst := getDST(c, servername)
if dst == "" {
dst = getDefaultDST()
glog.Debugf("use default dst %s for sni %s", dst, servername)
}
glog.Debugf("from %s, sni %s, forward to %s", c.RemoteAddr(), servername, dst)
forward(ctx, c, buf[:n], dst)
}

Loading…
Cancel
Save