relay: add direct routing for tunnel

This commit is contained in:
ginuerzh
2023-02-06 21:16:56 +08:00
parent 02a5f4dde4
commit 6f9f5ce6ab
9 changed files with 58 additions and 36 deletions

View File

@ -123,11 +123,10 @@ func (h *relayHandler) handleConnectTunnel(ctx context.Context, conn net.Conn, n
if ingress := h.md.ingress; ingress != nil {
tid = parseTunnelID(ingress.Get(host))
}
if !tid.Equal(tunnelID) {
if !tid.Equal(tunnelID) && !h.md.directTunnel {
resp.Status = relay.StatusBadRequest
resp.WriteTo(conn)
err := fmt.Errorf("tunnel %s not found", tunnelID.String())
err := fmt.Errorf("not route to host %s", host)
log.Error(err)
return err
}