feat: tlsmiddlebox experiment (#817)

See https://github.com/ooni/probe/issues/2124
This commit is contained in:
DecFox 2022-09-08 21:01:03 +05:30 committed by GitHub
commit f2b88ddb4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 1670 additions and 0 deletions

View file

@ -0,0 +1,25 @@
package tlsmiddlebox
//
// Utility functions for tlsmiddlebox
//
import (
"net"
)
// prepareAddrs prepares the resolved IP addresses by
// adding the configured port as a prefix
func prepareAddrs(addrs []string, port string) (out []string) {
if port == "" {
port = "443"
}
for _, addr := range addrs {
if net.ParseIP(addr) == nil {
continue
}
addr = net.JoinHostPort(addr, port)
out = append(out, addr)
}
return
}