git-svn-id: svn://47.119.165.148/zhub@58 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
lxy
2021-01-08 08:19:58 +00:00
commit c0e9fa0c6b
16 changed files with 1175 additions and 0 deletions

38
main.go Normal file
View File

@@ -0,0 +1,38 @@
package main
import (
"fmt"
"os"
"strconv"
"strings"
"zhub/cli"
"zhub/zdb"
)
func main() {
server := true
host := "127.0.0.1"
port := 1216
for _, arg := range os.Args[1:] {
if strings.EqualFold(arg, "cli") {
server = false
} else if strings.Index(arg, "-h=") == 0 {
host = arg[3:]
} else if strings.Index(arg, "-p=") == 0 {
p, err := strconv.Atoi(arg[3:])
if err != nil {
fmt.Println("-Error para: -p=[number]")
os.Exit(0)
}
port = p
}
}
if server {
zdb.ServerStart(host, port)
} else {
cli.ClientRun(host, port)
}
}