package nsqlookupd
import (
"log"
"os"
"time"
)
//记录nsqd配置信息
type Options struct {
Verbose bool `flag:"verbose"` //开启日志信息
TCPAddress string `flag:"tcp-address"` //tcp地址
HTTPAddress string `flag:"http-address"` //http地址
BroadcastAddress string `flag:"broadcast-address"`//broadcast地址
InactiveProducerTimeout time.Duration `flag:"inactive-producer-timeout"` //闲置周期
TombstoneLifetime time.Duration `flag:"tombstone-lifetime"` //过期时间时间
Logger Logger //日志接口
}
func NewOptions() *Options {
hostname, err := os.Hostname()
if err != nil {
log.Fatal(err)
}
return &Options{
TCPAddress: "0.0.0.0:4160",
HTTPAddress: "0.0.0.0:4161",
BroadcastAddress: hostname,
InactiveProducerTimeout: 300 * time.Second,
TombstoneLifetime: 45 * time.Second,
Logger: log.New(os.Stderr, "[nsqlookupd] ", log.Ldate|log.Ltime|log.Lmicroseconds),
}
}