mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-01 02:46:52 +00:00
style: fmt
This commit is contained in:
@@ -2,17 +2,18 @@ package client
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
"github.com/cnlh/nps/lib/config"
|
||||
"github.com/cnlh/nps/lib/conn"
|
||||
"github.com/cnlh/nps/lib/crypt"
|
||||
"github.com/cnlh/nps/lib/mux"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/xtaci/kcp-go"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TRPClient struct {
|
||||
|
@@ -1,12 +1,13 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
conn2 "github.com/cnlh/nps/lib/conn"
|
||||
"github.com/cnlh/nps/lib/file"
|
||||
"net"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
conn2 "github.com/cnlh/nps/lib/conn"
|
||||
"github.com/cnlh/nps/lib/file"
|
||||
)
|
||||
|
||||
func TestConfig(t *testing.T) {
|
||||
|
@@ -5,14 +5,6 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
"github.com/cnlh/nps/lib/config"
|
||||
"github.com/cnlh/nps/lib/conn"
|
||||
"github.com/cnlh/nps/lib/crypt"
|
||||
"github.com/cnlh/nps/lib/version"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/xtaci/kcp-go"
|
||||
"golang.org/x/net/proxy"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math"
|
||||
@@ -26,6 +18,15 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
"github.com/cnlh/nps/lib/config"
|
||||
"github.com/cnlh/nps/lib/conn"
|
||||
"github.com/cnlh/nps/lib/crypt"
|
||||
"github.com/cnlh/nps/lib/version"
|
||||
"github.com/xtaci/kcp-go"
|
||||
"golang.org/x/net/proxy"
|
||||
)
|
||||
|
||||
func GetTaskStatus(path string) {
|
||||
@@ -379,7 +380,7 @@ func sendP2PTestMsg(localConn *net.UDPConn, remoteAddr1, remoteAddr2, remoteAddr
|
||||
ip := common.GetIpByAddr(remoteAddr2)
|
||||
go func() {
|
||||
ports := getRandomPortArr(common.GetPortByAddr(remoteAddr3), common.GetPortByAddr(remoteAddr3)+interval*50)
|
||||
for i := 0; i <= 50; i ++ {
|
||||
for i := 0; i <= 50; i++ {
|
||||
go func(port int) {
|
||||
trueAddress := ip + ":" + strconv.Itoa(port)
|
||||
logs.Trace("try send test packet to target %s", trueAddress)
|
||||
|
@@ -2,15 +2,16 @@ package client
|
||||
|
||||
import (
|
||||
"container/heap"
|
||||
"github.com/cnlh/nps/lib/conn"
|
||||
"github.com/cnlh/nps/lib/file"
|
||||
"github.com/cnlh/nps/lib/sheap"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/pkg/errors"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/cnlh/nps/lib/conn"
|
||||
"github.com/cnlh/nps/lib/file"
|
||||
"github.com/cnlh/nps/lib/sheap"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var isStart bool
|
||||
@@ -70,7 +71,7 @@ func check(t *file.Health) {
|
||||
var rs *http.Response
|
||||
for _, v := range arr {
|
||||
if t.HealthCheckType == "tcp" {
|
||||
_, err = net.DialTimeout("tcp", v, time.Duration(t.HealthCheckTimeout)*time.Second);
|
||||
_, err = net.DialTimeout("tcp", v, time.Duration(t.HealthCheckTimeout)*time.Second)
|
||||
} else {
|
||||
client := &http.Client{}
|
||||
client.Timeout = time.Duration(t.HealthCheckTimeout) * time.Second
|
||||
|
@@ -1,6 +1,12 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
"github.com/cnlh/nps/lib/config"
|
||||
"github.com/cnlh/nps/lib/conn"
|
||||
@@ -8,12 +14,7 @@ import (
|
||||
"github.com/cnlh/nps/lib/file"
|
||||
"github.com/cnlh/nps/lib/mux"
|
||||
"github.com/cnlh/nps/server/proxy"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/xtaci/kcp-go"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -116,7 +117,7 @@ func StartLocalServer(l *config.LocalServer, config *config.CommonConfig) error
|
||||
|
||||
func handleUdpMonitor(config *config.CommonConfig, l *config.LocalServer) {
|
||||
ticker := time.NewTicker(time.Second * 1)
|
||||
for{
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if !udpConnStatus {
|
||||
|
@@ -2,9 +2,10 @@ package client
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
)
|
||||
|
||||
func RegisterLocalIp(server string, vKey string, tp string, proxyUrl string, hour int) {
|
||||
|
Reference in New Issue
Block a user