parseAddr() — fiber Function Reference
Architecture documentation for the parseAddr() function in helpers.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD e26cf47c_c4d0_b9c7_e705_90c0e5c40ea7["parseAddr()"] bec0e401_e4cd_f765_6df3_a79059073e50["helpers.go"] e26cf47c_c4d0_b9c7_e705_90c0e5c40ea7 -->|defined in| bec0e401_e4cd_f765_6df3_a79059073e50 style e26cf47c_c4d0_b9c7_e705_90c0e5c40ea7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
helpers.go lines 737–770
func parseAddr(raw string) (host, port string) { //nolint:nonamedreturns // gocritic unnamedResult requires naming host and port parts for clarity
if raw == "" {
return "", ""
}
raw = utils.TrimSpace(raw)
// Handle IPv6 addresses enclosed in brackets as defined by RFC 3986
if strings.HasPrefix(raw, "[") {
if end := strings.IndexByte(raw, ']'); end != -1 {
host = raw[:end+1] // keep the closing ]
if len(raw) > end+1 && raw[end+1] == ':' {
return host, raw[end+2:]
}
return host, ""
}
}
// Everything else with a colon
if i := strings.LastIndexByte(raw, ':'); i != -1 {
host, port = raw[:i], raw[i+1:]
// If “host” still contains ':', we must have hit an un-bracketed IPv6
// literal. In that form a port is impossible, so treat the whole thing
// as host.
if strings.IndexByte(host, ':') >= 0 {
return raw, ""
}
return host, port
}
// No colon, nothing to split
return raw, ""
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does parseAddr() do?
parseAddr() is a function in the fiber codebase, defined in helpers.go.
Where is parseAddr() defined?
parseAddr() is defined in helpers.go at line 737.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free