43 lines
798 B
Go
43 lines
798 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
//"github.com/dballard/warren/cmd/warrend/conf"
|
||
|
"github.com/dballard/warren/lib/warren"
|
||
|
"net"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
var poolUsage = `
|
||
|
pool [NAME] [LOW HIGH]
|
||
|
`
|
||
|
|
||
|
var poolCmd = &SockCommand{
|
||
|
Command: warren.Command{
|
||
|
Name: "pool",
|
||
|
Usage: poolUsage,
|
||
|
Summary: "Get/Set port pool range for deployment",
|
||
|
},
|
||
|
Run: poolRun,
|
||
|
}
|
||
|
|
||
|
// pool [name] -- get
|
||
|
// pool [name] [low] [high] -- set
|
||
|
func poolRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
|
||
|
if len(args) > 0 && args[0] == "help" {
|
||
|
warren.WriteStringz(c, cmd.Usage)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// GET
|
||
|
if len(args) == 1 {
|
||
|
warren.WriteStringz(c, "Pool GET " + strings.Join(args, ", ") + "\n")
|
||
|
return
|
||
|
}
|
||
|
if len(args) == 3 {
|
||
|
warren.WriteStringz(c, "Pool SET\n")
|
||
|
return
|
||
|
}
|
||
|
warren.WriteStringz(c, cmd.Usage)
|
||
|
return
|
||
|
}
|