mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
7f149f93c1
* Added function to get preffered network IP Also done some refactor work oon server package to make a lot more reusable * Added server.Option and simplified handler funcs * Added serial number deterministically generated from pk * Debugging TLS server connection * Implemented configurable server ip When accessing over the network the server needs to listen on the network port and not localhost or 127.0.0.1 . Also the cert can now have a dedicated IP * Refactor of URL funcs to use the url package * Removed redundant Options pattern in favour of config param * Added full server test using GetOutboundIP * Remove references and usage of Server.port The application does not need to set the port, we rely on the net.Listener to pick a port. * Version bump * Added ToECDSA func and improved cert testing * Added error check in test * Split Server types, embedding raw Server funcs into specialised server types * localhost * Implemented DNS and IP based cert gen ios doesn't allow for restricted ip addresses to be used in a valid tls cert * Replace listener handling with original port store Also added handlers as a parameter of the Server
23 lines
330 B
Go
23 lines
330 B
Go
package server
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
var (
|
|
defaultIP = net.IP{127, 0, 0, 1}
|
|
localhost = "localhost"
|
|
)
|
|
|
|
func GetOutboundIP() (net.IP, error) {
|
|
conn, err := net.Dial("udp", "255.255.255.255:8080")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer conn.Close()
|
|
|
|
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
|
|
|
return localAddr.IP, nil
|
|
}
|