Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22ae816

Browse files
authored
Merge pull request #4925 from fatedier/dev
bump version
2 parents af6bc63 + f795950 commit 22ae816

File tree

30 files changed

+901
-55
lines changed

30 files changed

+901
-55
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,4 @@ jobs:
2323
uses: golangci/golangci-lint-action@v8
2424
with:
2525
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
26-
version: v2.1
27-
28-
# Optional: golangci-lint command line arguments.
29-
# args: --issues-exit-code=0
30-
31-
# Optional: show only new issues if it's a pull request. The default value is `false`.
32-
# only-new-issues: true
33-
34-
# Optional: if set to true then the all caching functionality will be complete disabled,
35-
# takes precedence over all other caching options.
36-
# skip-cache: true
26+
version: v2.3

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ linters:
7373
- linters:
7474
- revive
7575
text: unused-parameter
76+
- linters:
77+
- revive
78+
text: "avoid meaningless package names"
7679
- linters:
7780
- unparam
7881
text: is always false

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,36 @@ frp is an open source project with its ongoing development made possible entirel
1313

1414
<h3 align="center">Gold Sponsors</h3>
1515
<!--gold sponsors start-->
16+
<p align="center">
17+
<a href="https://go.warp.dev/frp" target="_blank">
18+
<img width="360px" src="https://raw.githubusercontent.com/warpdotdev/brand-assets/refs/heads/main/Github/Sponsor/Warp-Github-LG-01.png">
19+
<br>
20+
<b>Warp, the intelligent terminal</b>
21+
<br>
22+
<sub>Available for macOS, Linux and Windows</sub>
23+
</a>
24+
</p>
1625
<p align="center">
1726
<a href="https://jb.gg/frp" target="_blank">
1827
<img width="420px" src="https://raw.githubusercontent.com/fatedier/frp/dev/doc/pic/sponsor_jetbrains.jpg">
28+
<br>
29+
<b>The complete IDE crafted for professional Go developers</b>
1930
</a>
2031
</p>
2132
<p align="center">
2233
<a href="https://github.com/daytonaio/daytona" target="_blank">
2334
<img width="420px" src="https://raw.githubusercontent.com/fatedier/frp/dev/doc/pic/sponsor_daytona.png">
35+
<br>
36+
<b>Secure and Elastic Infrastructure for Running Your AI-Generated Code</b>
2437
</a>
2538
</p>
2639
<p align="center">
2740
<a href="https://github.com/beclab/Olares" target="_blank">
2841
<img width="420px" src="https://raw.githubusercontent.com/fatedier/frp/dev/doc/pic/sponsor_olares.jpeg">
42+
<br>
43+
<b>The sovereign cloud that puts you in control</b>
44+
<br>
45+
<sub>An open source, self-hosted alternative to public clouds, built for data ownership and privacy</sub>
2946
</a>
3047
</p>
3148
<!--gold sponsors end-->
@@ -612,6 +629,21 @@ When specifying `auth.method = "token"` in `frpc.toml` and `frps.toml` - token b
612629

613630
Make sure to specify the same `auth.token` in `frps.toml` and `frpc.toml` for frpc to pass frps validation
614631

632+
##### Token Source
633+
634+
frp supports reading authentication tokens from external sources using the `tokenSource` configuration. Currently, file-based token source is supported.
635+
636+
**File-based token source:**
637+
638+
```toml
639+
# frpc.toml
640+
auth.method = "token"
641+
auth.tokenSource.type = "file"
642+
auth.tokenSource.file.path = "/path/to/token/file"
643+
```
644+
645+
The token will be read from the specified file at startup. This is useful for scenarios where tokens are managed by external systems or need to be kept separate from configuration files for security reasons.
646+
615647
#### OIDC Authentication
616648

617649
When specifying `auth.method = "oidc"` in `frpc.toml` and `frps.toml` - OIDC based authentication will be used.

Release.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## Features
22

3-
* Support for YAML merge functionality (anchors and references with dot-prefixed fields) in strict configuration mode without requiring `--strict-config=false` parameter.
4-
* Support for proxy protocol in UDP proxies to preserve real client IP addresses.
3+
* Support tokenSource for loading authentication tokens from files.
4+
5+
## Fixes
6+
7+
* Fix SSH tunnel gateway incorrectly binding to proxyBindAddr instead of bindAddr, which caused external connections to fail when proxyBindAddr was set to 127.0.0.1.

client/connector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type defaultConnectorImpl struct {
4848
cfg *v1.ClientCommonConfig
4949

5050
muxSession *fmux.Session
51-
quicConn quic.Connection
51+
quicConn *quic.Conn
5252
closeOnce sync.Once
5353
}
5454

client/service.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,16 @@ type ServiceOptions struct {
8888
}
8989

9090
// setServiceOptionsDefault sets the default values for ServiceOptions.
91-
func setServiceOptionsDefault(options *ServiceOptions) {
91+
func setServiceOptionsDefault(options *ServiceOptions) error {
9292
if options.Common != nil {
93-
options.Common.Complete()
93+
if err := options.Common.Complete(); err != nil {
94+
return err
95+
}
9496
}
9597
if options.ConnectorCreator == nil {
9698
options.ConnectorCreator = NewConnector
9799
}
100+
return nil
98101
}
99102

100103
// Service is the client service that connects to frps and provides proxy services.
@@ -134,7 +137,9 @@ type Service struct {
134137
}
135138

136139
func NewService(options ServiceOptions) (*Service, error) {
137-
setServiceOptionsDefault(&options)
140+
if err := setServiceOptionsDefault(&options); err != nil {
141+
return nil, err
142+
}
138143

139144
var webServer *httppkg.Server
140145
if options.Common.WebServer.Port > 0 {
@@ -398,6 +403,10 @@ func (svr *Service) stop() {
398403
svr.ctl.GracefulClose(svr.gracefulShutdownDuration)
399404
svr.ctl = nil
400405
}
406+
if svr.webServer != nil {
407+
svr.webServer.Close()
408+
svr.webServer = nil
409+
}
401410
}
402411

403412
func (svr *Service) getProxyStatus(name string) (*proxy.WorkingStatus, bool) {

client/visitor/xtcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func (ks *KCPTunnelSession) Close() {
398398
}
399399

400400
type QUICTunnelSession struct {
401-
session quic.Connection
401+
session *quic.Conn
402402
listenConn *net.UDPConn
403403
mu sync.RWMutex
404404

cmd/frpc/sub/nathole.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ var natholeDiscoveryCmd = &cobra.Command{
5151
cfg, _, _, _, err := config.LoadClientConfig(cfgFile, strictConfigMode)
5252
if err != nil {
5353
cfg = &v1.ClientCommonConfig{}
54-
cfg.Complete()
54+
if err := cfg.Complete(); err != nil {
55+
fmt.Printf("failed to complete config: %v\n", err)
56+
os.Exit(1)
57+
}
5558
}
5659
if natHoleSTUNServer != "" {
5760
cfg.NatHoleSTUNServer = natHoleSTUNServer

cmd/frpc/sub/proxy.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ func NewProxyCommand(name string, c v1.ProxyConfigurer, clientCfg *v1.ClientComm
7373
Use: name,
7474
Short: fmt.Sprintf("Run frpc with a single %s proxy", name),
7575
Run: func(cmd *cobra.Command, args []string) {
76-
clientCfg.Complete()
76+
if err := clientCfg.Complete(); err != nil {
77+
fmt.Println(err)
78+
os.Exit(1)
79+
}
7780
if _, err := validation.ValidateClientCommonConfig(clientCfg); err != nil {
7881
fmt.Println(err)
7982
os.Exit(1)
@@ -99,7 +102,10 @@ func NewVisitorCommand(name string, c v1.VisitorConfigurer, clientCfg *v1.Client
99102
Use: "visitor",
100103
Short: fmt.Sprintf("Run frpc with a single %s visitor", name),
101104
Run: func(cmd *cobra.Command, args []string) {
102-
clientCfg.Complete()
105+
if err := clientCfg.Complete(); err != nil {
106+
fmt.Println(err)
107+
os.Exit(1)
108+
}
103109
if _, err := validation.ValidateClientCommonConfig(clientCfg); err != nil {
104110
fmt.Println(err)
105111
os.Exit(1)

cmd/frps/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ var rootCmd = &cobra.Command{
7070
"please use yaml/json/toml format instead!\n")
7171
}
7272
} else {
73-
serverCfg.Complete()
73+
if err := serverCfg.Complete(); err != nil {
74+
fmt.Printf("failed to complete server config: %v\n", err)
75+
os.Exit(1)
76+
}
7477
svrCfg = &serverCfg
7578
}
7679

0 commit comments

Comments
 (0)