diff --git a/cmd/server.go b/cmd/server.go index 18d5b11..796a35d 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -77,12 +77,14 @@ func serverHandle(_ *cobra.Command, _ []string) { return } defer vc.Close() + log.Info("Core ", vc.Type(), " started") nodes := node.New() err = nodes.Start(c.NodeConfig, vc) if err != nil { log.WithField("err", err).Error("Run nodes failed") return } + log.Info("Nodes started") dns := os.Getenv("XRAY_DNS_PATH") if watch { err = c.Watch(config, dns, func() { @@ -102,11 +104,13 @@ func serverHandle(_ *cobra.Command, _ []string) { log.WithField("err", err).Error("Start core failed") return } + log.Info("Core ", vc.Type(), " restarted") err = nodes.Start(c.NodeConfig, vc) if err != nil { log.WithField("err", err).Error("Run nodes failed") return } + log.Info("Nodes restarted") runtime.GC() }) if err != nil { diff --git a/conf/node.go b/conf/node.go index 4d55f47..393849b 100644 --- a/conf/node.go +++ b/conf/node.go @@ -87,6 +87,7 @@ func (o *Options) UnmarshalJSON(data []byte) error { o.SingOptions = NewSingOptions() return json.Unmarshal(data, o.SingOptions) default: + o.Core = "" o.RawOptions = data } return nil diff --git a/core/selector.go b/core/selector.go index f72aded..6b220fe 100644 --- a/core/selector.go +++ b/core/selector.go @@ -108,5 +108,13 @@ func (s *Selector) Protocols() []string { } func (s *Selector) Type() string { - return "selector" + t := "Selector(" + for i := range s.cores { + if i != 0 { + t += " " + } + t += s.cores[i].Type() + } + t += ")" + return t }