~gsthnz/satellite

ref: 08c1a5a59b68a33880f45218cdfad85b6e1b7c65 satellite/utils.go -rw-r--r-- 332 bytes
08c1a5a5Paper Set minimum TLS version to TLS 1.2 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import "net"

func parseAddr(addr string) string {
	hostname, port, err := net.SplitHostPort(addr)
	if err != nil {
		ip := net.ParseIP(addr)
		if ip != nil {
			hostname = ip.String()
		}
	}
	if hostname == "" {
		hostname = "0.0.0.0"
	}
	if port == "" {
		port = "1965"
	}
	return net.JoinHostPort(hostname, port)
}