mirror of
https://github.com/csznet/goForward.git
synced 2025-12-24 13:37:51 +08:00
添加转发预处理
This commit is contained in:
10
sql/sql.go
10
sql/sql.go
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"csz.net/goForward/conf"
|
||||
@@ -103,8 +104,17 @@ func freeForward(localPort, protocol string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// 去掉所有空格
|
||||
func rmSpaces(input string) string {
|
||||
return strings.ReplaceAll(input, " ", "")
|
||||
}
|
||||
|
||||
// 增加转发
|
||||
func AddForward(newForward conf.ConnectionStats) int {
|
||||
//预处理
|
||||
newForward.RemoteAddr = rmSpaces(newForward.RemoteAddr)
|
||||
newForward.RemotePort = rmSpaces(newForward.RemotePort)
|
||||
newForward.LocalPort = rmSpaces(newForward.LocalPort)
|
||||
if newForward.Protocol != "udp" {
|
||||
newForward.Protocol = "tcp"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user