Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c44a5dade8 | ||
|
|
19a1e31904 |
@@ -108,6 +108,7 @@ func StartFromFile(path string) {
|
||||
logs.Info("Loading configuration file %s successfully", path)
|
||||
|
||||
SetTlsEnable(cnf.CommonConfig.TlsEnable)
|
||||
logs.Info("the version of client is %s, the core version of client is %s,tls enable is %t", version.VERSION, version.GetVersion(), GetTlsEnable())
|
||||
re:
|
||||
if first || cnf.CommonConfig.AutoReconnection {
|
||||
if !first {
|
||||
|
||||
+1
-1
@@ -229,9 +229,9 @@ func run() {
|
||||
if *verifyKey == "" {
|
||||
*verifyKey, _ = env["NPC_SERVER_VKEY"]
|
||||
}
|
||||
logs.Info("the version of client is %s, the core version of client is %s,tls enable is %t", version.VERSION, version.GetVersion(), client.GetTlsEnable())
|
||||
if *verifyKey != "" && *serverAddr != "" && *configPath == "" {
|
||||
client.SetTlsEnable(*tlsEnable)
|
||||
logs.Info("the version of client is %s, the core version of client is %s,tls enable is %t", version.VERSION, version.GetVersion(), client.GetTlsEnable())
|
||||
go func() {
|
||||
for {
|
||||
client.NewRPClient(*serverAddr, *verifyKey, *connType, *proxyUrl, nil, *disconnectTime).Start()
|
||||
|
||||
+17
-12
@@ -147,12 +147,27 @@ reset:
|
||||
if isReset {
|
||||
host.Client.AddConn()
|
||||
}
|
||||
if host, err = file.GetDb().GetInfoByHost(r.Host, r); err != nil {
|
||||
logs.Notice("the url %s %s %s can't be parsed!", r.URL.Scheme, r.Host, r.RequestURI)
|
||||
|
||||
remoteAddr = strings.TrimSpace(r.Header.Get("X-Forwarded-For"))
|
||||
if len(remoteAddr) == 0 {
|
||||
remoteAddr = c.RemoteAddr().String()
|
||||
}
|
||||
|
||||
// 判断访问地址是否在全局黑名单内
|
||||
if IsGlobalBlackIp(c.RemoteAddr().String()) {
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
|
||||
if host, err = file.GetDb().GetInfoByHost(r.Host, r); err != nil {
|
||||
logs.Notice("the url %s %s %s can't be parsed!, host %s, url %s, remote address %s", r.URL.Scheme, r.Host, r.RequestURI, r.Host, r.URL.Path, remoteAddr)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
|
||||
if err := s.CheckFlowAndConnNum(host.Client); err != nil {
|
||||
logs.Warn("client id %d, host id %d, error %s, when https connection", host.Client.Id, host.Id, err.Error())
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
if !isReset {
|
||||
@@ -167,12 +182,6 @@ reset:
|
||||
return
|
||||
}
|
||||
|
||||
// 判断访问地址是否在全局黑名单内
|
||||
if IsGlobalBlackIp(c.RemoteAddr().String()) {
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
|
||||
// 判断访问地址是否在黑名单内
|
||||
if common.IsBlackIp(c.RemoteAddr().String(), host.Client.VerifyKey, host.Client.BlackIpList) {
|
||||
c.Close()
|
||||
@@ -239,10 +248,6 @@ reset:
|
||||
//change the host and header and set proxy setting
|
||||
common.ChangeHostAndHeader(r, host.HostChange, host.HeaderChange, c.Conn.RemoteAddr().String(), s.addOrigin)
|
||||
|
||||
remoteAddr = strings.TrimSpace(r.Header.Get("X-Forwarded-For"))
|
||||
if len(remoteAddr) == 0 {
|
||||
remoteAddr = c.RemoteAddr().String()
|
||||
}
|
||||
logs.Info("%s request, method %s, host %s, url %s, remote address %s, target %s", r.URL.Scheme, r.Method, r.Host, r.URL.Path, remoteAddr, lk.Host)
|
||||
|
||||
//write
|
||||
|
||||
Reference in New Issue
Block a user