fn resolve(&mut self, server: String) -> Result<SocketAddr, &'static str> {
        if let Ok(result) = server.to_socket_addrs() {
            for addr in result {
                match addr {
                    SocketAddr::V4(_) => {
                        if self.config.internet_protocol() == InternetProtocol::Any ||
                            self.config.internet_protocol() == InternetProtocol::IpV4
                        {
                            return Ok(addr);
                        }
                    }
                    SocketAddr::V6(_) => {
                        if self.config.internet_protocol() == InternetProtocol::Any ||
                            self.config.internet_protocol() == InternetProtocol::IpV6
                        {
                            return Ok(addr);
                        }
                    }
                }
            }
        }
        Err("failed to convert to socket address")
    }
/// resolve host:ip to SocketAddr
resolve host:ip to SocketAddr
resolve host : ip to SocketAddr
fn resolve(&mut self, server: String) -> Result<SocketAddr, &'static str> {
        if let Ok(result) = server.to_socket_addrs() {
            for addr in result {
                match addr {
                    SocketAddr::V4(_) => {
                        if self.config.internet_protocol() == InternetProtocol::Any ||
                            self.config.internet_protocol() == InternetProtocol::IpV4
                        {
                            return Ok(addr);
                        }
                    }
                    SocketAddr::V6(_) => {
                        if self.config.internet_protocol() == InternetProtocol::Any ||
                            self.config.internet_protocol() == InternetProtocol::IpV6
                        {
                            return Ok(addr);
                        }
                    }
                }
            }
        }
        Err("failed to convert to socket address")
    }
fn resolve ( & mut self , server : String ) -> Result < SocketAddr , & ' static str > { if let Ok ( result ) = server . to_socket_addrs ( ) { for addr in result { match addr { SocketAddr :: V4 ( _ ) => { if self . config . internet_protocol ( ) == InternetProtocol :: Any || self . config . internet_protocol ( ) == InternetProtocol :: IpV4 { return Ok ( addr ) ; } } SocketAddr :: V6 ( _ ) => { if self . config . internet_protocol ( ) == InternetProtocol :: Any || self . config . internet_protocol ( ) == InternetProtocol :: IpV6 { return Ok ( addr ) ; } } } } } Err ( " " ) }
resolve host:ip to SocketAddr
resolve host : ip to SocketAddr
&mut self
server
String
&mut self
server
String