diff options
| author | bukton <buk_ton2@hotmail.com> | 2020-04-19 00:21:45 +0700 |
|---|---|---|
| committer | bukton <buk_ton2@hotmail.com> | 2020-04-19 00:21:45 +0700 |
| commit | 290c6b7f01f7b148a65ba10dd6536ad2567d7653 (patch) | |
| tree | e1abb141849419c40691097eea032b944fcbd748 /weed/util/parse.go | |
| parent | 6234ea441b6388838a19635c656316047f42917d (diff) | |
| parent | 11f5a6d91346e5f3cbf3b46e0a660e231c5c2998 (diff) | |
| download | seaweedfs-290c6b7f01f7b148a65ba10dd6536ad2567d7653.tar.xz seaweedfs-290c6b7f01f7b148a65ba10dd6536ad2567d7653.zip | |
Merge remote-tracking branch 'origin/master' into filer_mongodb
# Conflicts:
# go.mod
# go.sum
# weed/server/filer_server.go
Diffstat (limited to 'weed/util/parse.go')
| -rw-r--r-- | weed/util/parse.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/weed/util/parse.go b/weed/util/parse.go index 6593d43b6..0955db682 100644 --- a/weed/util/parse.go +++ b/weed/util/parse.go @@ -1,6 +1,7 @@ package util import ( + "fmt" "net/url" "strconv" "strings" @@ -45,3 +46,18 @@ func ParseFilerUrl(entryPath string) (filerServer string, filerPort int64, path path = u.Path return } + +func ParseHostPort(hostPort string) (filerServer string, filerPort int64, err error) { + parts := strings.Split(hostPort, ":") + if len(parts) != 2 { + err = fmt.Errorf("failed to parse %s\n", hostPort) + return + } + + filerPort, err = strconv.ParseInt(parts[1], 10, 64) + if err == nil { + filerServer = parts[0] + } + + return +} |
