Compare commits

..

1 Commits

Author SHA1 Message Date
Ujjwal Sharma 77387edd0d
src: rename Node and methods 2021-03-31 16:10:04 +05:30
2 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ mod keypair;
use keypair::SSBKeypair;
mod network;
use network::Host;
use network::Peer;
type Config = toml::map::Map<String, toml::Value>;
@ -49,7 +49,7 @@ async fn main() {
println!(
"{} {}",
peer,
Host::from_discovery_packet(&packet).to_discovery_packet()
Peer::from_discovery_packet(&packet).to_discovery_packet()
);
}
}

View File

@ -9,14 +9,14 @@ enum Protocol {
Wss,
}
pub struct Host {
pub struct Peer {
protocol: Protocol,
host: IpAddr,
port: u16,
pubkey: PublicKey,
}
impl Host {
impl Peer {
pub fn to_discovery_packet(&self) -> String {
let proto = match self.protocol {
Protocol::Net => "net",
@ -50,7 +50,7 @@ impl Host {
.parse()
.unwrap();
let pubkey = SSBPublicKey::from_base64(packet.next().unwrap());
Host {
Peer {
protocol,
host,
port,