Compare commits
1 Commits
db5f74ae86
...
77387edd0d
Author | SHA1 | Date |
---|---|---|
Ujjwal Sharma | 77387edd0d |
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue