TUN-3377: Tunnel route should check dns/lb before checking tunnel ID

This commit is contained in:
Adam Chalmers 2020-09-04 10:05:32 -05:00
parent 8764fbfdfa
commit 218ee30206
1 changed files with 9 additions and 4 deletions

View File

@ -412,20 +412,25 @@ func routeCommand(c *cli.Context) error {
}
const tunnelIDIndex = 1
tunnelID, err := sc.findID(c.Args().Get(tunnelIDIndex))
if err != nil {
return err
}
routeType := c.Args().First()
var r tunnelstore.Route
var tunnelID uuid.UUID
switch routeType {
case "dns":
tunnelID, err = sc.findID(c.Args().Get(tunnelIDIndex))
if err != nil {
return err
}
r, err = dnsRouteFromArg(c, tunnelID)
if err != nil {
return err
}
case "lb":
tunnelID, err = sc.findID(c.Args().Get(tunnelIDIndex))
if err != nil {
return err
}
r, err = lbRouteFromArg(c, tunnelID)
if err != nil {
return err