feat: README

This commit is contained in:
Patrick 2025-01-01 19:29:36 +01:00
parent 92ac9346cc
commit b9fef76c2c
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
2 changed files with 27 additions and 2 deletions

26
Readme.md Normal file
View file

@ -0,0 +1,26 @@
# MDNS Relay
You ever wanted to split your network into multiple indepented ones, while still being able to find
your printer or join a spotify session in another network? Then this project is for you.
The purpose of this program is to relay multicast DNS (mDNS) packets between multiple private networks.
Existing solution, such a avahi allow you to do this as well but only unconditionally, relaying all questions
and answers, with this you can decide what queries get relayed and which get blocked.
## Usage
`mdns-relay -c <config>` where config is a json file containing these options:
```json
{
"interfaces: "A regex used to filter interfaces on which to listen, to exclude for example the public net or VPNs completely",
// A list of rules to be applied to incoming packages"
"rules" : [
{
"from": "A regex to match the incoming interface",
"to": "The exact name of the interface to which matching packets will be relayed",
"allow_questions": "Regex matching any questions",
"allow_answers": "Regex matching any answers",
}
]
}
```
To apply a rule has to either have a single matching question or answer.

View file

@ -4,11 +4,10 @@ use color_eyre::{eyre::bail, Result};
use pnet::datalink::{interfaces, NetworkInterface}; use pnet::datalink::{interfaces, NetworkInterface};
use pnet::ipnetwork::IpNetwork::{V4, V6}; use pnet::ipnetwork::IpNetwork::{V4, V6};
use regex::Regex; use regex::Regex;
use serde::{Deserialize, Deserializer}; use serde::Deserialize;
use serde_json::from_reader; use serde_json::from_reader;
use simple_dns::Packet; use simple_dns::Packet;
use socket2::{Domain, Protocol, Socket, Type}; use socket2::{Domain, Protocol, Socket, Type};
use std::borrow::Cow;
use std::fs::File; use std::fs::File;
use std::io::BufReader; use std::io::BufReader;
use std::{ use std::{