mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-25 18:20:07 +00:00
proxymap, various: distinguish between different protocols
Previously, we were registering TCP and UDP connections in the same map, which could result in erroneously removing a mapping if one of the two connections completes while the other one is still active. Add a "proto string" argument to these functions to avoid this. Additionally, take the "proto" argument in LocalAPI, and plumb that through from the CLI and add a new LocalClient method. Updates tailscale/corp#20600 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I35d5efaefdfbf4721e315b8ca123f0c8af9125fb
This commit is contained in:
@@ -26,12 +26,14 @@ var whoisCmd = &ffcli.Command{
|
||||
FlagSet: func() *flag.FlagSet {
|
||||
fs := newFlagSet("whois")
|
||||
fs.BoolVar(&whoIsArgs.json, "json", false, "output in JSON format")
|
||||
fs.StringVar(&whoIsArgs.proto, "proto", "", `protocol; one of "tcp" or "udp"; empty mans both `)
|
||||
return fs
|
||||
}(),
|
||||
}
|
||||
|
||||
var whoIsArgs struct {
|
||||
json bool // output in JSON format
|
||||
json bool // output in JSON format
|
||||
proto string // "tcp" or "udp"
|
||||
}
|
||||
|
||||
func runWhoIs(ctx context.Context, args []string) error {
|
||||
@@ -40,7 +42,7 @@ func runWhoIs(ctx context.Context, args []string) error {
|
||||
} else if len(args) == 0 {
|
||||
return errors.New("missing argument, expected one peer")
|
||||
}
|
||||
who, err := localClient.WhoIs(ctx, args[0])
|
||||
who, err := localClient.WhoIsProto(ctx, whoIsArgs.proto, args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user