Skip to content

Commit fe7d5fd

Browse files
committed
Fix delimiter references in comments and update listenInterface documentation
1 parent 62cddfd commit fe7d5fd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

listeners.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ func (na NetworkAddress) Listen(ctx context.Context, portOffset uint, config net
170170
return na.listen(ctx, portOffset, config)
171171
}
172172

173-
// listenInterface resolves an interface name to a single IP address and creates a listener
174-
// based on the specified binding mode (auto, ipv4, ipv6, all).
175-
// Note: For 'all' mode, this function still returns only the first IP - the expansion
176-
// to multiple listeners happens at the HTTP Caddyfile parser level.
173+
// listenInterface resolves an interface name to an IP address and creates a listener.
174+
// For all binding modes, this function always returns one listener using the first resolved IP.
175+
// For multi-address modes (ipv4, ipv6, all), the expansion to multiple listeners
176+
// happens at the HTTP Caddyfile parser level (see addresses.go).
177177
func (na NetworkAddress) listenInterface(ctx context.Context, portOffset uint, config net.ListenConfig) (any, error) {
178178
// Decode interface name and mode from Host field
179-
// Format: "interface_name|~|mode"
179+
// Format: "interface_name||mode"
180180
var ifaceName string
181181
mode := InterfaceBindingAuto
182182

@@ -283,7 +283,7 @@ func (na NetworkAddress) IsInterfaceNetwork() bool {
283283
return false
284284
}
285285

286-
// Handle encoded interface name with mode: "interface_name|~|mode"
286+
// Handle encoded interface name with mode: "interface_name||mode"
287287
hostToCheck := na.Host
288288
if strings.Contains(na.Host, InterfaceDelimiter) {
289289
parts := strings.SplitN(na.Host, InterfaceDelimiter, 2)
@@ -1203,7 +1203,7 @@ func parseInterfaceAddress(network, host, port string) (NetworkAddress, error) {
12031203
}
12041204

12051205
// Encode the interface name and mode in the Host field
1206-
// Format: "interface_name|~|mode" so we can decode it later in listenInterface
1206+
// Format: "interface_name||mode" so we can decode it later in listenInterface
12071207
hostWithMode := fmt.Sprintf("%s%s%s", host, InterfaceDelimiter, string(mode))
12081208

12091209
return NetworkAddress{

0 commit comments

Comments
 (0)