We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tried to do this one myself but don't really know how the tor addresses are meant to be displayed.
ChatGPT gave me this but it's really ugly so didn't want to commit it
use core::fmt; impl fmt::Display for NetAddress { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { NetAddress::IPv4 { addr, port } => { write!( f, "{}.{}.{}.{}:{}", addr[0], addr[1], addr[2], addr[3], port ) } NetAddress::IPv6 { addr, port } => { write!( f, "{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:{:02x}{:02x}:%{}", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], addr[6], addr[7], addr[8], addr[9], addr[10], addr[11], addr[12], addr[13], addr[14], addr[15], port ) } NetAddress::OnionV2(addr) => { let mut onion = [0u8; 12]; onion.copy_from_slice(addr); let mut base32 = String::new(); // Implement your base32 encoding function here write!(f, "{}.onion", base32) } NetAddress::OnionV3 { ed25519_pubkey, checksum, version, port } => { // Implement your base32 encoding function here let mut onion = String::new(); write!(f, "{}.onion:{}", onion, port) } NetAddress::Hostname { hostname, port } => { write!(f, "{}:{}", hostname, port) } } } }
The text was updated successfully, but these errors were encountered:
Lol. After #2134 we'll have "implemented your own base32 encoding function here" we can reuse :).
Sorry, something went wrong.
Display
Closed by #2670
No branches or pull requests
tried to do this one myself but don't really know how the tor addresses are meant to be displayed.
ChatGPT gave me this but it's really ugly so didn't want to commit it
The text was updated successfully, but these errors were encountered: