Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Update netutils.go #1561

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/netutils/netutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func NetLimit() *rate.Rate {

// ExtractHost extracts host ip from the giving string.
func ExtractHost(hostAndPort string) string {
if stringutils.IsEmptyStr(hostAndPort) {
return ""
}
fields := strings.Split(strings.TrimSpace(hostAndPort), ":")
return fields[0]
}
Expand Down