@@ -32,7 +32,7 @@ type options struct {
32
32
func sshCode (host , dir string , o options ) error {
33
33
flog .Info ("ensuring code-server is updated..." )
34
34
35
- host , extraSSHFlags , err := parseIP (host )
35
+ host , extraSSHFlags , err := parseHost (host )
36
36
if err != nil {
37
37
return xerrors .Errorf ("failed to parse host IP: %w" , err )
38
38
}
@@ -350,19 +350,17 @@ func ensureDir(path string) error {
350
350
return nil
351
351
}
352
352
353
- // parseIP parses the host to a valid IP address . If 'gcp:' is prefixed to the
353
+ // parseHost parses the host argument . If 'gcp:' is prefixed to the
354
354
// host then a lookup is done using gcloud to determine the external IP and any
355
- // additional SSH arguments that should be used for ssh commands.
356
- func parseIP (host string ) (ip string , additionalFlags string , err error ) {
355
+ // additional SSH arguments that should be used for ssh commands. Otherwise, host
356
+ // is returned.
357
+ func parseHost (host string ) (parsedHost string , additionalFlags string , err error ) {
357
358
host = strings .TrimSpace (host )
358
359
switch {
359
360
case strings .HasPrefix (host , "gcp:" ):
360
361
instance := strings .TrimPrefix (host , "gcp:" )
361
362
return parseGCPSSHCmd (instance )
362
363
default :
363
- if net .ParseIP (host ) == nil {
364
- return "" , "" , xerrors .New ("host argument is not a valid IP address" )
365
- }
366
364
return host , "" , nil
367
365
}
368
366
}
0 commit comments