{"id":18577984,"url":"https://github.com/drasyl/netty-tun","last_synced_at":"2025-04-10T10:30:59.421Z","repository":{"id":36954115,"uuid":"443205781","full_name":"drasyl/netty-tun","owner":"drasyl","description":"netty channel communicating via TUN devices","archived":false,"fork":false,"pushed_at":"2024-04-16T20:27:39.000Z","size":953,"stargazers_count":9,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-17T23:55:05.328Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drasyl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-12-30T23:22:55.000Z","updated_at":"2024-04-22T10:26:49.867Z","dependencies_parsed_at":"2023-01-17T08:00:27.834Z","dependency_job_id":"a8586cd5-279e-490e-b09e-8d0371aa3268","html_url":"https://github.com/drasyl/netty-tun","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drasyl%2Fnetty-tun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drasyl%2Fnetty-tun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drasyl%2Fnetty-tun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drasyl%2Fnetty-tun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drasyl","download_url":"https://codeload.github.com/drasyl/netty-tun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199136,"owners_count":21063641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T23:32:40.423Z","updated_at":"2025-04-10T10:30:59.414Z","avatar_url":"https://github.com/drasyl.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netty-tun [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://opensource.org/licenses/MIT) [![Maven Central](https://img.shields.io/maven-central/v/org.drasyl/netty-tun.svg)](https://mvnrepository.com/artifact/org.drasyl/netty-tun) [![Javadoc](https://javadoc.io/badge2/org.drasyl/netty-tun/javadoc.svg)](https://www.javadoc.io/doc/org.drasyl/netty-tun)\n\nnetty channel communicating via TUN devices (tested on macOS, Ubuntu/Linux, and Windows 10/11).\n\n\u003e [!IMPORTANT]  \n\u003e If you would like this feature merged into Netty, I would greatly appreciate it if you could leave a :+1: on [my pull request](https://github.com/netty/netty/pull/12960). Thank you!\n\n## How to use\n\n```java\nEventLoopGroup group = new DefaultEventLoopGroup(1);\ntry {\n    final Bootstrap b = new Bootstrap()\n        .group(group)\n        .channel(TunChannel.class)\n        .handler(...);\n    final Channel ch = b.bind(new TunAddress()).sync().channel();\n    // send/receive messages of type TunPacket...\n    ch.closeFuture().sync();\n}\nfinally {\n    group.shutdownGracefully();\n}\n```\n\n### IP Address/Netmask\n\nYou can now assign an IP address and netmask to the created network interface (you can query the\nactual interface name by\ncalling [Channel#localAddress()](https://netty.io/4.1/api/io/netty/channel/Channel.html#localAddress--)):\n\n```bash\n# macOS\nsudo /sbin/ifconfig utun0 add 10.10.10.10 10.10.10.10\nsudo /sbin/ifconfig utun0 up\nsudo /sbin/route add -net 10.10.10.0/24 -iface utun0\n\n# Linux\nsudo /sbin/ip addr add 10.10.10.10/24 dev utun0\nsudo /sbin/ip link set dev utun0 up\n```\n\n```powershell\n# Windows\n$InterfaceIndex = Get-NetAdapter -Name utun0 | select ifIndex -expandproperty ifIndex\nNew-NetIPAddress -InterfaceIndex $InterfaceIndex -IPAddress 10.10.10.10 -PrefixLength 24\n\n# to allow peers access local services, you may mark the tun network as \"private\"\nSet-NetConnectionProfile -InterfaceIndex $InterfaceIndex -NetworkCategory \"Private\"\n```\n\n## MTU\n\nThe MTU size of the created network interface is by default 1500 on macOS/Linux and 65535 on Windows.\n\nOn macOS/Linux is can be adjusted by passing the channel option [`TunChannelOption.TUN_MTU`](https://github.com/drasyl/netty-tun/blob/master/src/main/java/org/drasyl/channel/tun/TunChannelOption.java) to the [`Bootstrap`](https://netty.io/4.1/api/io/netty/bootstrap/Bootstrap.html) object.\n\nOn Windows you have to use the following command:\n```powershell\nnetsh interface ipv4 set subinterface tun0 mtu=1234 store=active\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrasyl%2Fnetty-tun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrasyl%2Fnetty-tun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrasyl%2Fnetty-tun/lists"}