mirror of
https://github.com/koho/frpmgr.git
synced 2025-10-20 16:03:47 +08:00
Compare commits
2 Commits
d119834272
...
fad7bf8d8b
Author | SHA1 | Date | |
---|---|---|---|
fad7bf8d8b | |||
f628c39287 |
6
.github/workflows/golangci-lint.yml
vendored
6
.github/workflows/golangci-lint.yml
vendored
@ -18,9 +18,9 @@ jobs:
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Run
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v1.61
|
||||
version: v2.5
|
||||
|
2
.github/workflows/releaser.yml
vendored
2
.github/workflows/releaser.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Setup VS environment
|
||||
shell: powershell
|
||||
|
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Setup VS environment
|
||||
shell: powershell
|
||||
@ -72,7 +72,7 @@ jobs:
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
|
@ -1,13 +1,31 @@
|
||||
run:
|
||||
timeout: 5m
|
||||
|
||||
version: "2"
|
||||
linters:
|
||||
disable-all: true
|
||||
default: none
|
||||
enable:
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- typecheck
|
||||
- whitespace
|
||||
- unused
|
||||
- whitespace
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
rules:
|
||||
- linters:
|
||||
- staticcheck
|
||||
text: should not use dot imports
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
formatters:
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
4
go.mod
4
go.mod
@ -1,10 +1,10 @@
|
||||
module github.com/koho/frpmgr
|
||||
|
||||
go 1.23.0
|
||||
go 1.24.0
|
||||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.6.2
|
||||
github.com/fatedier/frp v0.64.0
|
||||
github.com/fatedier/frp v0.65.0
|
||||
github.com/fatedier/golib v0.5.1
|
||||
github.com/fsnotify/fsnotify v1.9.0
|
||||
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794
|
||||
|
4
go.sum
4
go.sum
@ -19,8 +19,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatedier/frp v0.64.0 h1:R9DAZ2J270cPCGBYCwCCYFxn+53hf5tl1J/eBdxCCmQ=
|
||||
github.com/fatedier/frp v0.64.0/go.mod h1:46gMhWuoI+QgwiOam/xR0HTkdoWSkOBRbd+JpWJr+k0=
|
||||
github.com/fatedier/frp v0.65.0 h1:Wn8qjXXf+G7+czZB0o7Y4U7Ohy9q/LOAqzK5AVKEel4=
|
||||
github.com/fatedier/frp v0.65.0/go.mod h1:P5aPIs0cqLWDKIYkOziZQGZpb4DwzQkRyK5h+OtPp0Y=
|
||||
github.com/fatedier/golib v0.5.1 h1:hcKAnaw5mdI/1KWRGejxR+i1Hn/NvbY5UsMKDr7o13M=
|
||||
github.com/fatedier/golib v0.5.1/go.mod h1:W6kIYkIFxHsTzbgqg5piCxIiDo4LzwgTY6R5W8l9NFQ=
|
||||
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
|
||||
|
@ -347,7 +347,7 @@ func (conf *ClientConfig) saveINI(path string) error {
|
||||
if err = common.ReflectFrom(&conf.ClientCommon); err != nil {
|
||||
return err
|
||||
}
|
||||
for k, v := range conf.ClientCommon.Metas {
|
||||
for k, v := range conf.Metas {
|
||||
common.Key("meta_" + k).SetValue(v)
|
||||
}
|
||||
for k, v := range conf.OIDCAdditionalEndpointParams {
|
||||
@ -464,7 +464,7 @@ func (conf *ClientConfig) Copy(all bool) *ClientConfig {
|
||||
newConf := NewDefaultClientConfig()
|
||||
newConf.ClientCommon = conf.ClientCommon
|
||||
// We can't share the same log file between different configs
|
||||
newConf.ClientCommon.LogFile = ""
|
||||
newConf.LogFile = ""
|
||||
if all {
|
||||
for _, proxy := range conf.Proxies {
|
||||
var newProxy = *proxy
|
||||
|
@ -521,7 +521,7 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
|
||||
if err != nil {
|
||||
return r, err
|
||||
}
|
||||
r.ProxyBackend.LocalPort = localPort
|
||||
r.LocalPort = localPort
|
||||
}
|
||||
bl, err := types.NewBandwidthQuantity(c.BandwidthLimit)
|
||||
if err != nil {
|
||||
@ -530,7 +530,7 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
|
||||
r.Transport.BandwidthLimit = bl
|
||||
switch c.Plugin {
|
||||
case consts.PluginHttp2Https:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.HTTP2HTTPSPluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.HTTP2HTTPSPluginOptions{
|
||||
Type: c.Plugin,
|
||||
LocalAddr: c.PluginLocalAddr,
|
||||
HostHeaderRewrite: c.PluginHostHeaderRewrite,
|
||||
@ -539,7 +539,7 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
|
||||
},
|
||||
}
|
||||
case consts.PluginHttp2Http:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.HTTP2HTTPPluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.HTTP2HTTPPluginOptions{
|
||||
Type: c.Plugin,
|
||||
LocalAddr: c.PluginLocalAddr,
|
||||
HostHeaderRewrite: c.PluginHostHeaderRewrite,
|
||||
@ -548,13 +548,13 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
|
||||
},
|
||||
}
|
||||
case consts.PluginHttpProxy:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.HTTPProxyPluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.HTTPProxyPluginOptions{
|
||||
Type: c.Plugin,
|
||||
HTTPUser: c.PluginHttpUser,
|
||||
HTTPPassword: c.PluginHttpPasswd,
|
||||
}
|
||||
case consts.PluginHttps2Http:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.HTTPS2HTTPPluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.HTTPS2HTTPPluginOptions{
|
||||
Type: c.Plugin,
|
||||
LocalAddr: c.PluginLocalAddr,
|
||||
HostHeaderRewrite: c.PluginHostHeaderRewrite,
|
||||
@ -566,7 +566,7 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
|
||||
KeyPath: c.PluginKeyPath,
|
||||
}
|
||||
case consts.PluginHttps2Https:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.HTTPS2HTTPSPluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.HTTPS2HTTPSPluginOptions{
|
||||
Type: c.Plugin,
|
||||
LocalAddr: c.PluginLocalAddr,
|
||||
HostHeaderRewrite: c.PluginHostHeaderRewrite,
|
||||
@ -578,13 +578,13 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
|
||||
KeyPath: c.PluginKeyPath,
|
||||
}
|
||||
case consts.PluginSocks5:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.Socks5PluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.Socks5PluginOptions{
|
||||
Type: c.Plugin,
|
||||
Username: c.PluginUser,
|
||||
Password: c.PluginPasswd,
|
||||
}
|
||||
case consts.PluginStaticFile:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.StaticFilePluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.StaticFilePluginOptions{
|
||||
Type: c.Plugin,
|
||||
LocalPath: c.PluginLocalPath,
|
||||
StripPrefix: c.PluginStripPrefix,
|
||||
@ -592,12 +592,12 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
|
||||
HTTPPassword: c.PluginHttpPasswd,
|
||||
}
|
||||
case consts.PluginUnixDomain:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.UnixDomainSocketPluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.UnixDomainSocketPluginOptions{
|
||||
Type: c.Plugin,
|
||||
UnixPath: c.PluginUnixPath,
|
||||
}
|
||||
case consts.PluginTLS2Raw:
|
||||
r.ProxyBackend.Plugin.ClientPluginOptions = &v1.TLS2RawPluginOptions{
|
||||
r.Plugin.ClientPluginOptions = &v1.TLS2RawPluginOptions{
|
||||
Type: c.Plugin,
|
||||
LocalAddr: c.PluginLocalAddr,
|
||||
CrtPath: c.PluginCrtPath,
|
||||
|
@ -499,25 +499,25 @@ func (pd *EditProxyDialog) onSave() {
|
||||
}
|
||||
}
|
||||
// Update metadata
|
||||
pd.binder.Proxy.Metas = pd.metaModel.AsMap()
|
||||
pd.binder.Metas = pd.metaModel.AsMap()
|
||||
// Update role
|
||||
if pd.binder.Visitor {
|
||||
pd.binder.Proxy.Role = "visitor"
|
||||
pd.binder.Role = "visitor"
|
||||
} else {
|
||||
pd.binder.Proxy.Role = ""
|
||||
pd.binder.Role = ""
|
||||
}
|
||||
// Update bandwidth
|
||||
if pd.binder.BandwidthNum > 0 {
|
||||
pd.binder.Proxy.BandwidthLimit = strconv.FormatInt(pd.binder.BandwidthNum, 10) + pd.binder.BandwidthUnit
|
||||
if pd.binder.Proxy.BandwidthLimitMode == consts.BandwidthMode[0] {
|
||||
pd.binder.Proxy.BandwidthLimitMode = ""
|
||||
pd.binder.BandwidthLimit = strconv.FormatInt(pd.binder.BandwidthNum, 10) + pd.binder.BandwidthUnit
|
||||
if pd.binder.BandwidthLimitMode == consts.BandwidthMode[0] {
|
||||
pd.binder.BandwidthLimitMode = ""
|
||||
}
|
||||
} else {
|
||||
pd.binder.Proxy.BandwidthLimit = ""
|
||||
pd.binder.Proxy.BandwidthLimitMode = ""
|
||||
pd.binder.BandwidthLimit = ""
|
||||
pd.binder.BandwidthLimitMode = ""
|
||||
}
|
||||
pd.binder.Proxy.LocalPort = strings.TrimSpace(pd.binder.Proxy.LocalPort)
|
||||
pd.binder.Proxy.RemotePort = strings.TrimSpace(pd.binder.Proxy.RemotePort)
|
||||
pd.binder.LocalPort = strings.TrimSpace(pd.binder.LocalPort)
|
||||
pd.binder.RemotePort = strings.TrimSpace(pd.binder.RemotePort)
|
||||
if ok := pd.validateProxy(pd.binder.Proxy); !ok {
|
||||
return
|
||||
}
|
||||
|
@ -238,10 +238,8 @@ func (pv *PanelView) Invalidate(state bool) {
|
||||
pv.addressText.SetText(addr)
|
||||
}
|
||||
pv.protoImage.SetVisible(data.TLSEnable || data.Protocol == consts.ProtoWSS || data.Protocol == consts.ProtoQUIC)
|
||||
proto := data.Protocol
|
||||
if proto == "" {
|
||||
proto = consts.ProtoTCP
|
||||
} else if proto == consts.ProtoWebsocket {
|
||||
proto := util.GetOrElse(data.Protocol, consts.ProtoTCP)
|
||||
if proto == consts.ProtoWebsocket {
|
||||
proto = "ws"
|
||||
}
|
||||
proto = strings.ToUpper(proto)
|
||||
|
Reference in New Issue
Block a user