Convert for util.IP to just use a net.IP

pflag can handle IP addresses so use the pflag code instead of doing it
ourselves. This means our code just uses net.IP and we don't have all of
the useless casting back and forth!
This commit is contained in:
Eric Paris
2015-08-05 15:42:13 -04:00
parent 65bff3d187
commit fe6b633e2a
9 changed files with 52 additions and 112 deletions

View File

@@ -48,7 +48,7 @@ import (
// SchedulerServer has all the context and params needed to run a Scheduler
type SchedulerServer struct {
Port int
Address util.IP
Address net.IP
AlgorithmProvider string
PolicyConfigFile string
EnableProfiling bool
@@ -62,7 +62,7 @@ type SchedulerServer struct {
func NewSchedulerServer() *SchedulerServer {
s := SchedulerServer{
Port: ports.SchedulerPort,
Address: util.IP(net.ParseIP("127.0.0.1")),
Address: net.ParseIP("127.0.0.1"),
AlgorithmProvider: factory.DefaultProvider,
}
return &s
@@ -71,7 +71,7 @@ func NewSchedulerServer() *SchedulerServer {
// AddFlags adds flags for a specific SchedulerServer to the specified FlagSet
func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&s.Port, "port", s.Port, "The port that the scheduler's http service runs on")
fs.Var(&s.Address, "address", "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
fs.IPVar(&s.Address, "address", s.Address, "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
fs.StringVar(&s.AlgorithmProvider, "algorithm-provider", s.AlgorithmProvider, "The scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
fs.StringVar(&s.PolicyConfigFile, "policy-config-file", s.PolicyConfigFile, "File with scheduler policy configuration")
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")