I’ve a Go TLS server with a wildcard domain *.myserver.com so remote clients can call it with foo.myserver.com or bar.myserver.com, is there some way I can find out which hostname a client used from the net.Conn that I get back Listerner.Accept()?
All I’ve found so far is if i use GetConfigForClient on the tls.Config of the server then that function does get the server name:
you could store this info in a data structure and then do lookup in the handler. ClientHelloInfo contains also the net.Conn so maybe you could use a map with net.Conn as key
The problem with that is that net.Conn is an interface and the instance from the ClientHelloInfo in getConfigForClient is not the same thing that is returned from net.Listener.Accept()
We have something wokring now by using a map with key net.Conn.RemoteAddr().String() which is the remote client’s ip address and port. This seems to work ok, but is it going to be unique it all scenarios?