Skip to content

Commit c5c79e4

Browse files
authored
Merge pull request #2324 from fatedier/dev
bump version v0.36.2
2 parents 55da58e + 9a849a2 commit c5c79e4

File tree

23 files changed

+99
-74
lines changed

23 files changed

+99
-74
lines changed

Makefile.cross-compiles

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export PATH := $(GOPATH)/bin:$(PATH)
22
export GO111MODULE=on
33
LDFLAGS := -s -w
44

5-
os-archs=darwin:amd64 darwin:arm64 freebsd:386 freebsd:amd64 linux:386 linux:amd64 linux:arm windows:386 windows:amd64 linux:mips64 linux:mips64le linux:mips:softfloat linux:mipsle:softfloat
5+
os-archs=darwin:amd64 darwin:arm64 freebsd:386 freebsd:amd64 linux:386 linux:amd64 linux:arm linux:arm64 windows:386 windows:amd64 linux:mips64 linux:mips64le linux:mips:softfloat linux:mipsle:softfloat
66

77
all: build
88

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ This feature is suitable for a large number of short connections.
732732

733733
Load balancing is supported by `group`.
734734

735-
This feature is only available for types `tcp` and `http` now.
735+
This feature is only available for types `tcp`, `http`, `tcpmux` now.
736736

737737
```ini
738738
# frpc.ini
@@ -1006,7 +1006,7 @@ frpc will generate 8 proxies like `test_tcp_0`, `test_tcp_1`, ..., `test_tcp_7`.
10061006

10071007
frpc only forwards requests to local TCP or UDP ports by default.
10081008

1009-
Plugins are used for providing rich features. There are built-in plugins such as `unix_domain_socket`, `http_proxy`, `socks5`, `static_file` and you can see [example usage](#example-usage).
1009+
Plugins are used for providing rich features. There are built-in plugins such as `unix_domain_socket`, `http_proxy`, `socks5`, `static_file`, `http2https`, `https2http`, `https2https` and you can see [example usage](#example-usage).
10101010

10111011
Specify which plugin to use with the `plugin` parameter. Configuration parameters of plugin should be started with `plugin_`. `local_ip` and `local_port` are not used for plugin.
10121012

assets/frpc/statik/statik.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

assets/frps/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html> <html lang=en> <head> <meta charset=utf-8> <title>frps dashboard</title> <link rel="shortcut icon" href="favicon.ico"></head> <body> <div id=app></div> <script type="text/javascript" src="manifest.js?b8b55d8156200869417b"></script><script type="text/javascript" src="vendor.js?3e078a9d741093b909de"></script></body> </html>
1+
<!doctype html> <html lang=en> <head> <meta charset=utf-8> <title>frps dashboard</title> <link rel="shortcut icon" href="favicon.ico"></head> <body> <div id=app></div> <script type="text/javascript" src="manifest.js?782d7b1b910e824ac986"></script><script type="text/javascript" src="vendor.js?7f899297af075fb3b085"></script></body> </html>

assets/frps/static/manifest.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/frps/static/vendor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/frps/statik/statik.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cmd/frpc/sub/root.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ func parseClientCommonCfg(fileType int, source []byte) (cfg config.ClientCommonC
139139
return
140140
}
141141

142-
err = cfg.Check()
142+
cfg.Complete()
143+
err = cfg.Validate()
143144
if err != nil {
145+
err = fmt.Errorf("Parse config error: %v", err)
144146
return
145147
}
146148
return
@@ -167,11 +169,6 @@ func parseClientCommonCfgFromCmd() (cfg config.ClientCommonConf, err error) {
167169
cfg.LogLevel = logLevel
168170
cfg.LogFile = logFile
169171
cfg.LogMaxDays = int64(logMaxDays)
170-
if logFile == "console" {
171-
cfg.LogWay = "console"
172-
} else {
173-
cfg.LogWay = "file"
174-
}
175172
cfg.DisableLogColor = disableLogColor
176173

177174
// Only token authentication is supported in cmd mode
@@ -186,21 +183,20 @@ func runClient(cfgFilePath string) (err error) {
186183
var content []byte
187184
content, err = config.GetRenderedConfFromFile(cfgFilePath)
188185
if err != nil {
189-
return
186+
return err
190187
}
191188

192189
cfg, err := parseClientCommonCfg(CfgFileTypeIni, content)
193190
if err != nil {
194-
return
191+
return err
195192
}
196193

197194
pxyCfgs, visitorCfgs, err := config.LoadAllProxyConfsFromIni(cfg.User, content, cfg.Start)
198195
if err != nil {
199-
return
196+
return err
200197
}
201198

202-
err = startService(cfg, pxyCfgs, visitorCfgs, cfgFilePath)
203-
return
199+
return startService(cfg, pxyCfgs, visitorCfgs, cfgFilePath)
204200
}
205201

206202
func startService(

cmd/frps/root.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,13 @@ var rootCmd = &cobra.Command{
105105
var cfg config.ServerCommonConf
106106
var err error
107107
if cfgFile != "" {
108-
log.Info("frps uses config file: %s", cfgFile)
109108
var content []byte
110109
content, err = config.GetRenderedConfFromFile(cfgFile)
111110
if err != nil {
112111
return err
113112
}
114113
cfg, err = parseServerCommonCfg(CfgFileTypeIni, content)
115114
} else {
116-
log.Info("frps uses command line arguments for config")
117115
cfg, err = parseServerCommonCfg(CfgFileTypeCmd, nil)
118116
}
119117
if err != nil {
@@ -144,9 +142,10 @@ func parseServerCommonCfg(fileType int, source []byte) (cfg config.ServerCommonC
144142
if err != nil {
145143
return
146144
}
147-
148-
err = cfg.Check()
145+
cfg.Complete()
146+
err = cfg.Validate()
149147
if err != nil {
148+
err = fmt.Errorf("Parse config error: %v", err)
150149
return
151150
}
152151
return
@@ -190,18 +189,19 @@ func parseServerCommonCfgFromCmd() (cfg config.ServerCommonConf, err error) {
190189
}
191190
}
192191
cfg.MaxPortsPerClient = maxPortsPerClient
193-
194-
if logFile == "console" {
195-
cfg.LogWay = "console"
196-
} else {
197-
cfg.LogWay = "file"
198-
}
199192
cfg.DisableLogColor = disableLogColor
200193
return
201194
}
202195

203196
func runServer(cfg config.ServerCommonConf) (err error) {
204197
log.InitLog(cfg.LogWay, cfg.LogFile, cfg.LogLevel, cfg.LogMaxDays, cfg.DisableLogColor)
198+
199+
if cfgFile != "" {
200+
log.Info("frps uses config file: %s", cfgFile)
201+
} else {
202+
log.Info("frps uses command line arguments for config")
203+
}
204+
205205
svr, err := server.NewService(cfg)
206206
if err != nil {
207207
return err

pkg/config/client.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
// recommended to use GetDefaultClientConf instead of creating this object
3030
// directly, so that all unspecified fields have reasonable default values.
3131
type ClientCommonConf struct {
32-
auth.ClientConfig `ini:",extends" json:"inline"`
32+
auth.ClientConfig `ini:",extends"`
3333

3434
// ServerAddr specifies the address of the server to connect to. By
3535
// default, this value is "0.0.0.0".
@@ -173,13 +173,21 @@ func GetDefaultClientConf() ClientCommonConf {
173173
}
174174
}
175175

176-
func (cfg *ClientCommonConf) Check() error {
176+
func (cfg *ClientCommonConf) Complete() {
177+
if cfg.LogFile == "console" {
178+
cfg.LogWay = "console"
179+
} else {
180+
cfg.LogWay = "file"
181+
}
182+
}
183+
184+
func (cfg *ClientCommonConf) Validate() error {
177185
if cfg.HeartbeatInterval <= 0 {
178-
return fmt.Errorf("Parse conf error: invalid heartbeat_interval")
186+
return fmt.Errorf("invalid heartbeat_interval")
179187
}
180188

181189
if cfg.HeartbeatTimeout < cfg.HeartbeatInterval {
182-
return fmt.Errorf("Parse conf error: invalid heartbeat_timeout, heartbeat_timeout is less than heartbeat_interval")
190+
return fmt.Errorf("invalid heartbeat_timeout, heartbeat_timeout is less than heartbeat_interval")
183191
}
184192

185193
if cfg.TLSEnable == false {
@@ -196,6 +204,10 @@ func (cfg *ClientCommonConf) Check() error {
196204
}
197205
}
198206

207+
if cfg.Protocol != "tcp" && cfg.Protocol != "kcp" && cfg.Protocol != "websocket" {
208+
return fmt.Errorf("invalid protocol")
209+
}
210+
199211
return nil
200212
}
201213

0 commit comments

Comments
 (0)