1
0
Fork 0
forked from External/ergo
This commit is contained in:
Shivaram Lingamneni 2020-09-24 02:44:12 -04:00
parent 0ca27cfeda
commit bcdf61bd7a
3 changed files with 17 additions and 4 deletions

View file

@ -5,6 +5,7 @@
package utils
import (
"fmt"
"net"
"regexp"
"strings"
@ -193,3 +194,11 @@ func HandleXForwardedFor(remoteAddr string, xForwardedFor string, whitelist []ne
// or nil:
return
}
func DescribeConn(conn net.Conn) string {
// XXX for unix domain sockets, this is not informative enough for an operator
// to determine who holds the other side of the connection. there seems to be
// no way to get either the correct file descriptor of the connection, or the
// udiag_ino from `man 7 sock_diag`. maybe there's something else we can do?
return fmt.Sprintf("%s <-> %s", conn.LocalAddr().String(), conn.RemoteAddr().String())
}