mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-09 06:18:31 -04:00
Merge pull request #64 from aramperes/fix/63
This commit is contained in:
commit
e26cca089f
5 changed files with 26 additions and 4 deletions
4
.cargo/config.toml
Normal file
4
.cargo/config.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[env]
|
||||||
|
# Each interface needs 1 IP allocated to the WireGuard peer IP.
|
||||||
|
# "8" = 7 tunnels per protocol.
|
||||||
|
SMOLTCP_IFACE_MAX_ADDR_COUNT = "8"
|
|
@ -126,6 +126,14 @@ INFO onetun::tunnel > Tunneling TCP [127.0.0.1:8081]->[192.168.4.4:8081] (via [
|
||||||
|
|
||||||
... would open TCP ports 8080 and 8081 locally, which forward to their respective ports on the different peers.
|
... would open TCP ports 8080 and 8081 locally, which forward to their respective ports on the different peers.
|
||||||
|
|
||||||
|
#### Maximum number of tunnels
|
||||||
|
|
||||||
|
`smoltcp` imposes a compile-time limit on the number of IP addresses assigned to an interface. **onetun** increases
|
||||||
|
the default value to support most use-cases. In effect, the default limit on the number of **onetun** peers
|
||||||
|
is **7 per protocol** (TCP and UDP).
|
||||||
|
|
||||||
|
Should you need more unique IP addresses to forward ports to, you can increase the limit in `.cargo/config.toml` and recompile **onetun**.
|
||||||
|
|
||||||
### UDP Support
|
### UDP Support
|
||||||
|
|
||||||
**onetun** supports UDP forwarding. You can add `:UDP` at the end of the port-forward configuration, or `UDP,TCP` to support
|
**onetun** supports UDP forwarding. You can add `:UDP` at the end of the port-forward configuration, or `UDP,TCP` to support
|
||||||
|
|
|
@ -55,8 +55,14 @@ impl VirtualIpDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl smoltcp::phy::Device for VirtualIpDevice {
|
impl smoltcp::phy::Device for VirtualIpDevice {
|
||||||
type RxToken<'a> = RxToken where Self: 'a;
|
type RxToken<'a>
|
||||||
type TxToken<'a> = TxToken where Self: 'a;
|
= RxToken
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
type TxToken<'a>
|
||||||
|
= TxToken
|
||||||
|
where
|
||||||
|
Self: 'a;
|
||||||
|
|
||||||
fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
|
fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
|
||||||
let next = {
|
let next = {
|
||||||
|
|
|
@ -94,7 +94,9 @@ impl VirtualInterfacePoll for TcpVirtualInterface {
|
||||||
let mut iface = Interface::new(config, &mut device, Instant::now());
|
let mut iface = Interface::new(config, &mut device, Instant::now());
|
||||||
iface.update_ip_addrs(|ip_addrs| {
|
iface.update_ip_addrs(|ip_addrs| {
|
||||||
addresses.into_iter().for_each(|addr| {
|
addresses.into_iter().for_each(|addr| {
|
||||||
ip_addrs.push(addr).unwrap();
|
ip_addrs
|
||||||
|
.push(addr)
|
||||||
|
.expect("maximum number of IPs in TCP interface reached");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,9 @@ impl VirtualInterfacePoll for UdpVirtualInterface {
|
||||||
let mut iface = Interface::new(config, &mut device, Instant::now());
|
let mut iface = Interface::new(config, &mut device, Instant::now());
|
||||||
iface.update_ip_addrs(|ip_addrs| {
|
iface.update_ip_addrs(|ip_addrs| {
|
||||||
addresses.into_iter().for_each(|addr| {
|
addresses.into_iter().for_each(|addr| {
|
||||||
ip_addrs.push(addr).unwrap();
|
ip_addrs
|
||||||
|
.push(addr)
|
||||||
|
.expect("maximum number of IPs in UDP interface reached");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue