Improve IP/Port parsing

This commit is contained in:
Daniel
2023-09-06 11:08:02 +02:00
parent 21cd8cb9e5
commit 1376e46d21
3 changed files with 29 additions and 43 deletions

View File

@@ -115,7 +115,7 @@ func GetNetworkHost(ctx context.Context, remoteIP net.IP) (process *Process, err
// GetProcessByRequestOrigin returns the process that initiated the API request ar.
func GetProcessByRequestOrigin(ar *api.Request) (*Process, error) {
// get remote IP/Port
remoteIP, remotePort, err := netutils.ParseHostPort(ar.RemoteAddr)
remoteIP, remotePort, err := netutils.ParseIPPort(ar.RemoteAddr)
if err != nil {
return nil, fmt.Errorf("failed to get remote IP/Port: %w", err)
}