enhanced to http server to distinguish between ipv4 and ipv6 address when the ip address part is explicitly specified before colon port (e.g. 0.0.0.0:9999, [::]:9999, :9999)
This commit is contained in:
14
hodu.go
14
hodu.go
@ -25,3 +25,17 @@ type Service interface {
|
||||
WriteLog(id string, level LogLevel, fmtstr string, args ...interface{})
|
||||
}
|
||||
|
||||
func tcp_addr_str_class(addr string) string {
|
||||
if len(addr) > 0 {
|
||||
switch addr[0] {
|
||||
case '[':
|
||||
return "tcp6"
|
||||
case ':':
|
||||
return "tcp"
|
||||
default:
|
||||
return "tcp4"
|
||||
}
|
||||
}
|
||||
|
||||
return "tcp"
|
||||
}
|
||||
|
Reference in New Issue
Block a user