[−][src]Crate cjdns_sniff
Library for sniffing and injecting cjdns traffic.
NOTE: This requires cjdns v18 or higher.
API
Sniffer::sniff_traffic(conn, type)
conn
- a cjdns-admin which is connected to an existing cjdns engine on the local machine.type
- the type of traffic to sniff, seeContentType
in cjdns-hdr (you probably wantContentType::Cjdht
).
Example
async { let cjdns = cjdns_admin::connect(None).await?; let mut sniffer = Sniffer::sniff_traffic(cjdns, ContentType::Cjdht).await?; let msg = sniffer.receive().await?; println!("{:?}", msg); sniffer.disconnect().await?; }
Message structure
route_header
ARouteHeader
object (see cjdns-hdr).data_header
ADataHeader
object (see cjdns-hdr).content_bytes
Raw binary of the content, if it cannot be decoded into neithercontent_benc
norcontent
.raw_bytes
The whole message's serialized representation.content_benc
optional in the event that thecontent_type
isContentType::Cjdht
the b-decoded content.content
optional in the event that the message is control message (route_header.is_ctrl == true
).
Structs
Connection | Admin connection to the CJDNS node. |
CtrlMessage | Serialized control message |
Message | Message that is being sent or received by cjdns router. |
Sniffer | Wraps connection to cjdns admin interface and allows to send and receive messages of a certain type. |
Enums
ConnectError | Connection or disconnection error. |
Content | Message content enum. |
ContentType | Header content types. |
ReceiveError | Error while receiving message. |
SendError | Error while sending message. |