relay: added private tunnel

This commit is contained in:
ginuerzh
2023-01-29 11:55:26 +08:00
parent 93b40f4c86
commit 24037aba7b
11 changed files with 174 additions and 59 deletions

View File

@ -195,18 +195,23 @@ func (h *relayHandler) Handle(ctx context.Context, conn net.Conn, opts ...handle
}
if h.hop != nil {
if address != "" {
resp.Status = relay.StatusForbidden
log.Error("forward mode, connect is forbidden")
_, err := resp.WriteTo(conn)
return err
}
/*
if address != "" {
resp.Status = relay.StatusForbidden
log.Error("forward mode, CONNECT method is forbidden")
_, err := resp.WriteTo(conn)
return err
}
*/
// forward mode
return h.handleForward(ctx, conn, network, log)
}
switch req.Cmd & relay.CmdMask {
case 0, relay.CmdConnect:
case relay.CmdConnect:
if !tunnelID.IsZero() {
return h.handleConnectTunnel(ctx, conn, network, address, tunnelID, log)
}
return h.handleConnect(ctx, conn, network, address, log)
case relay.CmdBind:
if !tunnelID.IsZero() {