mirror of
https://github.com/fatedier/frp.git
synced 2025-04-23 07:01:27 +00:00
comments
This commit is contained in:
parent
3b577109d4
commit
ac9b121314
@ -271,6 +271,7 @@ func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) {
|
|||||||
metrics.Server.AddTrafficIn(name, proxyType, inCount)
|
metrics.Server.AddTrafficIn(name, proxyType, inCount)
|
||||||
metrics.Server.AddTrafficOut(name, proxyType, outCount)
|
metrics.Server.AddTrafficOut(name, proxyType, outCount)
|
||||||
|
|
||||||
|
// Log the duration of connection.
|
||||||
if IsTheTypeToLog(serverCfg.Log.DurationTypes, name) {
|
if IsTheTypeToLog(serverCfg.Log.DurationTypes, name) {
|
||||||
endtime := time.Now().UnixNano() / 1000000 // time in microseconds
|
endtime := time.Now().UnixNano() / 1000000 // time in microseconds
|
||||||
connectionDuration := endtime - startime
|
connectionDuration := endtime - startime
|
||||||
@ -283,6 +284,7 @@ func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check Duration should be loged or not. True: while connection name contain a string in logDurationTypes.
|
||||||
func IsTheTypeToLog(logDurationTypes string, name string) bool {
|
func IsTheTypeToLog(logDurationTypes string, name string) bool {
|
||||||
if strings.Contains(logDurationTypes, "all") {
|
if strings.Contains(logDurationTypes, "all") {
|
||||||
return true
|
return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user