mirror of https://github.com/docker/docs.git
improve addr validation
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
c76c29fd11
commit
3cc61b728f
5
join.go
5
join.go
|
@ -1,7 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
@ -21,8 +21,7 @@ func join(c *cli.Context) {
|
|||
}
|
||||
|
||||
addr := c.String("addr")
|
||||
addrParts := strings.SplitN(addr, ":", 2)
|
||||
if len(addrParts) != 2 {
|
||||
if m, _ := regexp.MatchString("^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}:[0-9]{1,5}$", addr); !m {
|
||||
log.Fatal("--addr should be of the form ip:port")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue