add router component

This commit is contained in:
ginuerzh
2023-11-19 14:23:21 +08:00
parent 88cc6ff4d5
commit 74639e9c4e
25 changed files with 788 additions and 123 deletions

View File

@ -85,7 +85,9 @@ func (ep *entrypoint) handle(ctx context.Context, conn net.Conn) error {
var tunnelID relay.TunnelID
if ep.ingress != nil {
tunnelID = parseTunnelID(ep.ingress.Get(ctx, req.Host))
if rule := ep.ingress.GetRule(ctx, req.Host); rule != nil {
tunnelID = parseTunnelID(rule.Endpoint)
}
}
if tunnelID.IsZero() {
err := fmt.Errorf("no route to host %s", req.Host)