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

@ -177,8 +177,13 @@ func (h *tunnelHandler) Handle(ctx context.Context, conn net.Conn, opts ...handl
if h.ingress != nil {
tunnelID = parseTunnelID(h.ingress.Get(host))
}
if tunnelID.IsZero() {
err := fmt.Errorf("no route to host %s", host)
log.Error(err)
return err
}
if tunnelID.IsPrivate() {
err := fmt.Errorf("access denied: tunnel %s is private", tunnelID)
err := fmt.Errorf("access denied: tunnel %s is private for host %s", tunnelID, host)
log.Error(err)
return err
}