Jelajahi Sumber

improve error role log info

fatedier 7 tahun lalu
induk
melakukan
cc160995da
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      models/config/proxy.go

+ 2 - 2
models/config/proxy.go

@@ -635,7 +635,7 @@ func (cfg *StcpProxyConf) LoadFromFile(name string, section ini.Section) (err er
 	if tmpStr == "server" || tmpStr == "visitor" {
 		cfg.Role = tmpStr
 	} else {
-		cfg.Role = "server"
+		return fmt.Errorf("Parse conf error: incorrect role [%s]", tmpStr)
 	}
 
 	cfg.Sk = section["sk"]
@@ -724,7 +724,7 @@ func (cfg *XtcpProxyConf) LoadFromFile(name string, section ini.Section) (err er
 	if tmpStr == "server" || tmpStr == "visitor" {
 		cfg.Role = tmpStr
 	} else {
-		cfg.Role = "server"
+		return fmt.Errorf("Parse conf error: incorrect role [%s]", tmpStr)
 	}
 
 	cfg.Sk = section["sk"]