Compare commits

..

No commits in common. "f7a06cbe61b0eb703a65b9ebabed036ed45fe8ca" and "b14192a8d3bb5b5a844977ea82de9a7d87dbdf06" have entirely different histories.

13 changed files with 36 additions and 36 deletions

View File

@ -17,13 +17,13 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: '1.23' go-version: '1.22'
cache: false cache: false
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v4 uses: golangci/golangci-lint-action@v4
with: with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.61 version: v1.57
# Optional: golangci-lint command line arguments. # Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0 # args: --issues-exit-code=0

View File

@ -15,7 +15,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: '1.23' go-version: '1.22'
- name: Make All - name: Make All
run: | run: |

View File

@ -1,5 +1,5 @@
service: service:
golangci-lint-version: 1.61.x # use the fixed version to not introduce new linters unexpectedly golangci-lint-version: 1.57.x # use the fixed version to not introduce new linters unexpectedly
run: run:
concurrency: 4 concurrency: 4
@ -14,7 +14,7 @@ linters:
enable: enable:
- unused - unused
- errcheck - errcheck
- copyloopvar - exportloopref
- gocritic - gocritic
- gofumpt - gofumpt
- goimports - goimports
@ -90,7 +90,6 @@ linters-settings:
- G402 - G402
- G404 - G404
- G501 - G501
- G115 # integer overflow conversion
issues: issues:
# List of regexps of issue texts to exclude, empty list by default. # List of regexps of issue texts to exclude, empty list by default.

View File

@ -1,4 +1,5 @@
### Features ### Features
* The frpc visitor command-line parameter adds the `--server-user` option to specify the username of the server-side proxy to connect to. * The frpc visitor command-line parameter adds the `--server-user` option to specify the username of the server-side proxy to connect to.
* Support multiple frpc instances with different subjects when using oidc authentication. * Support multiple frpc instances with different subjects when using oidc authentication.

View File

@ -137,7 +137,7 @@ func (pw *Wrapper) SetRunningStatus(remoteAddr string, respErr string) error {
pw.Phase = ProxyPhaseStartErr pw.Phase = ProxyPhaseStartErr
pw.Err = respErr pw.Err = respErr
pw.lastStartErr = time.Now() pw.lastStartErr = time.Now()
return fmt.Errorf("%s", pw.Err) return fmt.Errorf(pw.Err)
} }
if err := pw.pxy.Run(); err != nil { if err := pw.pxy.Run(); err != nil {

View File

@ -327,7 +327,7 @@ requestHeaders.set.x-from-where = "frp"
[[proxies]] [[proxies]]
name = "plugin_tls2raw" name = "plugin_tls2raw"
type = "tcp" type = "https"
remotePort = 6008 remotePort = 6008
[proxies.plugin] [proxies.plugin]
type = "tls2raw" type = "tls2raw"

View File

@ -1,4 +1,4 @@
FROM golang:1.23 AS building FROM golang:1.22 AS building
COPY . /building COPY . /building
WORKDIR /building WORKDIR /building

View File

@ -1,4 +1,4 @@
FROM golang:1.23 AS building FROM golang:1.22 AS building
COPY . /building COPY . /building
WORKDIR /building WORKDIR /building

View File

@ -159,18 +159,18 @@ func NewPortsRangeSliceFromString(str string) ([]PortsRange, error) {
out = append(out, PortsRange{Single: int(singleNum)}) out = append(out, PortsRange{Single: int(singleNum)})
case 2: case 2:
// range numbers // range numbers
minNum, err := strconv.ParseInt(strings.TrimSpace(numArray[0]), 10, 64) min, err := strconv.ParseInt(strings.TrimSpace(numArray[0]), 10, 64)
if err != nil { if err != nil {
return nil, fmt.Errorf("range number is invalid, %v", err) return nil, fmt.Errorf("range number is invalid, %v", err)
} }
maxNum, err := strconv.ParseInt(strings.TrimSpace(numArray[1]), 10, 64) max, err := strconv.ParseInt(strings.TrimSpace(numArray[1]), 10, 64)
if err != nil { if err != nil {
return nil, fmt.Errorf("range number is invalid, %v", err) return nil, fmt.Errorf("range number is invalid, %v", err)
} }
if maxNum < minNum { if max < min {
return nil, fmt.Errorf("range number is invalid") return nil, fmt.Errorf("range number is invalid")
} }
out = append(out, PortsRange{Start: int(minNum), End: int(maxNum)}) out = append(out, PortsRange{Start: int(min), End: int(max)})
default: default:
return nil, fmt.Errorf("range number is invalid") return nil, fmt.Errorf("range number is invalid")
} }

View File

@ -78,9 +78,9 @@ func ListAllLocalIPs() ([]net.IP, error) {
return ips, nil return ips, nil
} }
func ListLocalIPsForNatHole(maxItems int) ([]string, error) { func ListLocalIPsForNatHole(max int) ([]string, error) {
if maxItems <= 0 { if max <= 0 {
return nil, fmt.Errorf("maxItems must be greater than 0") return nil, fmt.Errorf("max must be greater than 0")
} }
ips, err := ListAllLocalIPs() ips, err := ListAllLocalIPs()
@ -88,9 +88,9 @@ func ListLocalIPsForNatHole(maxItems int) ([]string, error) {
return nil, err return nil, err
} }
filtered := make([]string, 0, maxItems) filtered := make([]string, 0, max)
for _, ip := range ips { for _, ip := range ips {
if len(filtered) >= maxItems { if len(filtered) >= max {
break break
} }

View File

@ -85,21 +85,21 @@ func ParseRangeNumbers(rangeStr string) (numbers []int64, err error) {
numbers = append(numbers, singleNum) numbers = append(numbers, singleNum)
case 2: case 2:
// range numbers // range numbers
minValue, errRet := strconv.ParseInt(strings.TrimSpace(numArray[0]), 10, 64) min, errRet := strconv.ParseInt(strings.TrimSpace(numArray[0]), 10, 64)
if errRet != nil { if errRet != nil {
err = fmt.Errorf("range number is invalid, %v", errRet) err = fmt.Errorf("range number is invalid, %v", errRet)
return return
} }
maxValue, errRet := strconv.ParseInt(strings.TrimSpace(numArray[1]), 10, 64) max, errRet := strconv.ParseInt(strings.TrimSpace(numArray[1]), 10, 64)
if errRet != nil { if errRet != nil {
err = fmt.Errorf("range number is invalid, %v", errRet) err = fmt.Errorf("range number is invalid, %v", errRet)
return return
} }
if maxValue < minValue { if max < min {
err = fmt.Errorf("range number is invalid") err = fmt.Errorf("range number is invalid")
return return
} }
for i := minValue; i <= maxValue; i++ { for i := min; i <= max; i++ {
numbers = append(numbers, i) numbers = append(numbers, i)
} }
default: default:
@ -118,13 +118,13 @@ func GenerateResponseErrorString(summary string, err error, detailed bool) strin
} }
func RandomSleep(duration time.Duration, minRatio, maxRatio float64) time.Duration { func RandomSleep(duration time.Duration, minRatio, maxRatio float64) time.Duration {
minValue := int64(minRatio * 1000.0) min := int64(minRatio * 1000.0)
maxValue := int64(maxRatio * 1000.0) max := int64(maxRatio * 1000.0)
var n int64 var n int64
if maxValue <= minValue { if max <= min {
n = minValue n = min
} else { } else {
n = mathrand.Int64N(maxValue-minValue) + minValue n = mathrand.Int64N(max-min) + min
} }
d := duration * time.Duration(n) / time.Duration(1000) d := duration * time.Duration(n) / time.Duration(1000)
time.Sleep(d) time.Sleep(d)

View File

@ -14,7 +14,7 @@
package version package version
var version = "0.61.0" var version = "0.60.0"
func Full() string { func Full() string {
return version return version

View File

@ -137,17 +137,17 @@ func (pxy *BaseProxy) GetWorkConnFromPool(src, dst net.Addr) (workConn net.Conn,
dstAddr string dstAddr string
srcPortStr string srcPortStr string
dstPortStr string dstPortStr string
srcPort uint64 srcPort int
dstPort uint64 dstPort int
) )
if src != nil { if src != nil {
srcAddr, srcPortStr, _ = net.SplitHostPort(src.String()) srcAddr, srcPortStr, _ = net.SplitHostPort(src.String())
srcPort, _ = strconv.ParseUint(srcPortStr, 10, 16) srcPort, _ = strconv.Atoi(srcPortStr)
} }
if dst != nil { if dst != nil {
dstAddr, dstPortStr, _ = net.SplitHostPort(dst.String()) dstAddr, dstPortStr, _ = net.SplitHostPort(dst.String())
dstPort, _ = strconv.ParseUint(dstPortStr, 10, 16) dstPort, _ = strconv.Atoi(dstPortStr)
} }
err := msg.WriteMsg(workConn, &msg.StartWorkConn{ err := msg.WriteMsg(workConn, &msg.StartWorkConn{
ProxyName: pxy.GetName(), ProxyName: pxy.GetName(),
@ -190,8 +190,8 @@ func (pxy *BaseProxy) startCommonTCPListenersHandler() {
} else { } else {
tempDelay *= 2 tempDelay *= 2
} }
if maxTime := 1 * time.Second; tempDelay > maxTime { if max := 1 * time.Second; tempDelay > max {
tempDelay = maxTime tempDelay = max
} }
xl.Infof("met temporary error: %s, sleep for %s ...", err, tempDelay) xl.Infof("met temporary error: %s, sleep for %s ...", err, tempDelay)
time.Sleep(tempDelay) time.Sleep(tempDelay)