"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cmd/frps/root.go" between
frp-0.36.1.tar.gz and frp-0.36.2.tar.gz

About: frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet. As of now, it supports TCP and UDP, as well as HTTP and HTTPS protocols, and it also has a P2P connect mode.

root.go  (frp-0.36.1):root.go  (frp-0.36.2)
skipping to change at line 108 skipping to change at line 108
Short: "frps is the server of frp (https://github.com/fatedier/frp)", Short: "frps is the server of frp (https://github.com/fatedier/frp)",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if showVersion { if showVersion {
fmt.Println(version.Full()) fmt.Println(version.Full())
return nil return nil
} }
var cfg config.ServerCommonConf var cfg config.ServerCommonConf
var err error var err error
if cfgFile != "" { if cfgFile != "" {
log.Info("frps uses config file: %s", cfgFile)
var content []byte var content []byte
content, err = config.GetRenderedConfFromFile(cfgFile) content, err = config.GetRenderedConfFromFile(cfgFile)
if err != nil { if err != nil {
return err return err
} }
cfg, err = parseServerCommonCfg(CfgFileTypeIni, content) cfg, err = parseServerCommonCfg(CfgFileTypeIni, content)
} else { } else {
log.Info("frps uses command line arguments for config")
cfg, err = parseServerCommonCfg(CfgFileTypeCmd, nil) cfg, err = parseServerCommonCfg(CfgFileTypeCmd, nil)
} }
if err != nil { if err != nil {
return err return err
} }
err = runServer(cfg) err = runServer(cfg)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
os.Exit(1) os.Exit(1)
skipping to change at line 147 skipping to change at line 145
func parseServerCommonCfg(fileType int, source []byte) (cfg config.ServerCommonC onf, err error) { func parseServerCommonCfg(fileType int, source []byte) (cfg config.ServerCommonC onf, err error) {
if fileType == CfgFileTypeIni { if fileType == CfgFileTypeIni {
cfg, err = config.UnmarshalServerConfFromIni(source) cfg, err = config.UnmarshalServerConfFromIni(source)
} else if fileType == CfgFileTypeCmd { } else if fileType == CfgFileTypeCmd {
cfg, err = parseServerCommonCfgFromCmd() cfg, err = parseServerCommonCfgFromCmd()
} }
if err != nil { if err != nil {
return return
} }
cfg.Complete()
err = cfg.Check() err = cfg.Validate()
if err != nil { if err != nil {
err = fmt.Errorf("Parse config error: %v", err)
return return
} }
return return
} }
func parseServerCommonCfgFromCmd() (cfg config.ServerCommonConf, err error) { func parseServerCommonCfgFromCmd() (cfg config.ServerCommonConf, err error) {
cfg = config.GetDefaultServerConf() cfg = config.GetDefaultServerConf()
cfg.BindAddr = bindAddr cfg.BindAddr = bindAddr
cfg.BindPort = bindPort cfg.BindPort = bindPort
skipping to change at line 193 skipping to change at line 192
if errRet != nil { if errRet != nil {
err = fmt.Errorf("Parse conf error: allow_ports: %v", err Ret) err = fmt.Errorf("Parse conf error: allow_ports: %v", err Ret)
return return
} }
for _, port := range ports { for _, port := range ports {
cfg.AllowPorts[int(port)] = struct{}{} cfg.AllowPorts[int(port)] = struct{}{}
} }
} }
cfg.MaxPortsPerClient = maxPortsPerClient cfg.MaxPortsPerClient = maxPortsPerClient
if logFile == "console" {
cfg.LogWay = "console"
} else {
cfg.LogWay = "file"
}
cfg.DisableLogColor = disableLogColor cfg.DisableLogColor = disableLogColor
return return
} }
func runServer(cfg config.ServerCommonConf) (err error) { func runServer(cfg config.ServerCommonConf) (err error) {
log.InitLog(cfg.LogWay, cfg.LogFile, cfg.LogLevel, cfg.LogMaxDays, cfg.Di sableLogColor) log.InitLog(cfg.LogWay, cfg.LogFile, cfg.LogLevel, cfg.LogMaxDays, cfg.Di sableLogColor)
if cfgFile != "" {
log.Info("frps uses config file: %s", cfgFile)
} else {
log.Info("frps uses command line arguments for config")
}
svr, err := server.NewService(cfg) svr, err := server.NewService(cfg)
if err != nil { if err != nil {
return err return err
} }
log.Info("frps started successfully") log.Info("frps started successfully")
svr.Run() svr.Run()
return return
} }
 End of changes. 6 change blocks. 
10 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)