mirror of
https://github.com/fatedier/frp.git
synced 2025-05-08 15:38:27 +00:00
Compare commits
3 Commits
4d33400d49
...
17d0fe4d1d
Author | SHA1 | Date | |
---|---|---|---|
|
17d0fe4d1d | ||
|
256b87321d | ||
|
4991596dae |
@ -26,7 +26,7 @@ frpsPath=${ROOT}/bin/frps
|
||||
if [ "${FRPS_PATH}" ]; then
|
||||
frpsPath="${FRPS_PATH}"
|
||||
fi
|
||||
concurrency="12"
|
||||
concurrency="16"
|
||||
if [ "${CONCURRENCY}" ]; then
|
||||
concurrency="${CONCURRENCY}"
|
||||
fi
|
||||
|
@ -17,6 +17,7 @@ package server
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
@ -282,7 +283,7 @@ func (svr *Service) apiProxyByTypeAndName(w http.ResponseWriter, r *http.Request
|
||||
res := GeneralResponse{Code: 200}
|
||||
params := mux.Vars(r)
|
||||
proxyType := params["type"]
|
||||
name := params["name"]
|
||||
name, _ := url.QueryUnescape(params["name"])
|
||||
|
||||
defer func() {
|
||||
log.Info("Http response [%s]: code [%d]", r.URL.Path, res.Code)
|
||||
@ -350,7 +351,7 @@ type GetProxyTrafficResp struct {
|
||||
func (svr *Service) apiProxyTraffic(w http.ResponseWriter, r *http.Request) {
|
||||
res := GeneralResponse{Code: 200}
|
||||
params := mux.Vars(r)
|
||||
name := params["name"]
|
||||
name, _ := url.QueryUnescape(params["name"])
|
||||
|
||||
defer func() {
|
||||
log.Info("Http response [%s]: code [%d]", r.URL.Path, res.Code)
|
||||
|
@ -67,7 +67,7 @@ func NewDefaultFramework() *Framework {
|
||||
TotalParallelNode: suiteConfig.ParallelTotal,
|
||||
CurrentNodeIndex: suiteConfig.ParallelProcess,
|
||||
FromPortIndex: 10000,
|
||||
ToPortIndex: 60000,
|
||||
ToPortIndex: 30000,
|
||||
}
|
||||
return NewFramework(options)
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []str
|
||||
ExpectNoError(err)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
currentClientProcesses := make([]*process.Process, 0, len(clientTemplates))
|
||||
for i := range clientTemplates {
|
||||
@ -76,7 +76,7 @@ func (f *Framework) RunFrps(args ...string) (*process.Process, string, error) {
|
||||
return p, p.StdOutput(), err
|
||||
}
|
||||
// sleep for a while to get std output
|
||||
time.Sleep(time.Second)
|
||||
time.Sleep(2 * time.Second)
|
||||
return p, p.StdOutput(), nil
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ func (f *Framework) RunFrpc(args ...string) (*process.Process, string, error) {
|
||||
if err != nil {
|
||||
return p, p.StdOutput(), err
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
time.Sleep(2 * time.Second)
|
||||
return p, p.StdOutput(), nil
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,11 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
clientConf := consts.LegacyDefaultClientConfig
|
||||
|
||||
serverConf += `
|
||||
allow_ports = 20000-25000,25002,30000-50000
|
||||
allow_ports = 10000-11000,11002,12000-13000
|
||||
`
|
||||
|
||||
tcpPortName := port.GenName("TCP", port.WithRangePorts(20000, 25000))
|
||||
udpPortName := port.GenName("UDP", port.WithRangePorts(30000, 50000))
|
||||
tcpPortName := port.GenName("TCP", port.WithRangePorts(10000, 11000))
|
||||
udpPortName := port.GenName("UDP", port.WithRangePorts(12000, 13000))
|
||||
clientConf += fmt.Sprintf(`
|
||||
[tcp-allowded-in-range]
|
||||
type = tcp
|
||||
@ -37,7 +37,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
[tcp-port-not-allowed]
|
||||
type = tcp
|
||||
local_port = {{ .%s }}
|
||||
remote_port = 25001
|
||||
remote_port = 11001
|
||||
`, framework.TCPEchoServerPort)
|
||||
clientConf += fmt.Sprintf(`
|
||||
[tcp-port-unavailable]
|
||||
@ -55,7 +55,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
[udp-port-not-allowed]
|
||||
type = udp
|
||||
local_port = {{ .%s }}
|
||||
remote_port = 25003
|
||||
remote_port = 11003
|
||||
`, framework.UDPEchoServerPort)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
@ -65,7 +65,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
framework.NewRequestExpect(f).PortName(tcpPortName).Ensure()
|
||||
|
||||
// Not Allowed
|
||||
framework.NewRequestExpect(f).Port(25001).ExpectError(true).Ensure()
|
||||
framework.NewRequestExpect(f).Port(11001).ExpectError(true).Ensure()
|
||||
|
||||
// Unavailable, already bind by frps
|
||||
framework.NewRequestExpect(f).PortName(consts.PortServerName).ExpectError(true).Ensure()
|
||||
@ -76,7 +76,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
|
||||
// Not Allowed
|
||||
framework.NewRequestExpect(f).RequestModify(func(r *request.Request) {
|
||||
r.UDP().Port(25003)
|
||||
r.UDP().Port(11003)
|
||||
}).ExpectError(true).Ensure()
|
||||
})
|
||||
|
||||
|
@ -79,6 +79,7 @@ func (pa *Allocator) GetByName(portName string) int {
|
||||
udpConn.Close()
|
||||
|
||||
pa.used.Insert(port)
|
||||
pa.reserved.Delete(port)
|
||||
return port
|
||||
}
|
||||
return 0
|
||||
|
@ -23,14 +23,14 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
|
||||
serverConf += `
|
||||
allowPorts = [
|
||||
{ start = 20000, end = 25000 },
|
||||
{ single = 25002 },
|
||||
{ start = 30000, end = 50000 },
|
||||
{ start = 10000, end = 11000 },
|
||||
{ single = 11002 },
|
||||
{ start = 12000, end = 13000 },
|
||||
]
|
||||
`
|
||||
|
||||
tcpPortName := port.GenName("TCP", port.WithRangePorts(20000, 25000))
|
||||
udpPortName := port.GenName("UDP", port.WithRangePorts(30000, 50000))
|
||||
tcpPortName := port.GenName("TCP", port.WithRangePorts(10000, 11000))
|
||||
udpPortName := port.GenName("UDP", port.WithRangePorts(12000, 13000))
|
||||
clientConf += fmt.Sprintf(`
|
||||
[[proxies]]
|
||||
name = "tcp-allowded-in-range"
|
||||
@ -43,7 +43,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
name = "tcp-port-not-allowed"
|
||||
type = "tcp"
|
||||
localPort = {{ .%s }}
|
||||
remotePort = 25001
|
||||
remotePort = 11001
|
||||
`, framework.TCPEchoServerPort)
|
||||
clientConf += fmt.Sprintf(`
|
||||
[[proxies]]
|
||||
@ -64,7 +64,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
name = "udp-port-not-allowed"
|
||||
type = "udp"
|
||||
localPort = {{ .%s }}
|
||||
remotePort = 25003
|
||||
remotePort = 11003
|
||||
`, framework.UDPEchoServerPort)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
@ -74,7 +74,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
framework.NewRequestExpect(f).PortName(tcpPortName).Ensure()
|
||||
|
||||
// Not Allowed
|
||||
framework.NewRequestExpect(f).Port(25001).ExpectError(true).Ensure()
|
||||
framework.NewRequestExpect(f).Port(11001).ExpectError(true).Ensure()
|
||||
|
||||
// Unavailable, already bind by frps
|
||||
framework.NewRequestExpect(f).PortName(consts.PortServerName).ExpectError(true).Ensure()
|
||||
@ -85,7 +85,7 @@ var _ = ginkgo.Describe("[Feature: Server Manager]", func() {
|
||||
|
||||
// Not Allowed
|
||||
framework.NewRequestExpect(f).RequestModify(func(r *request.Request) {
|
||||
r.UDP().Port(25003)
|
||||
r.UDP().Port(11003)
|
||||
}).ExpectError(true).Ensure()
|
||||
})
|
||||
|
||||
|
@ -11,7 +11,7 @@ const props = defineProps<{
|
||||
}>()
|
||||
|
||||
const fetchData = () => {
|
||||
let url = '../api/traffic/' + props.proxyName
|
||||
let url = '../api/traffic/' + encodeURIComponent(props.proxyName)
|
||||
fetch(url, { credentials: 'include' })
|
||||
.then((res) => {
|
||||
return res.json()
|
||||
|
Loading…
x
Reference in New Issue
Block a user