Categorygithub.com/optman/p2p-tun
modulepackage
0.1.1
Repository: https://github.com/optman/p2p-tun.git
Documentation: pkg.go.dev

# README

p2p-tun

A simple port forward and tun2socks tools build on libp2p, hole punching supported by rndz-go.

Usage

NAME:
   p2p-tun - port forward and tun2socks through libp2p

USAGE:
   p2p-tun [global options] command [command options] [arguments...]

COMMANDS:
   client   start client node
   server   start server node
   genkey   generate a private key
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --private-key value  private key generated by genkey cmd [$PRIVATE_KEY]
   --listen-addrs value  p2p listen multiaddress (default: "/ip4/0.0.0.0/udp/0/p2p-circuit/dns/rndz.optman.net/udp/8888, /ip4/0.0.0.0/tcp/0/p2p-circuit/dns/rndz.optman.net/tcp/8888")  (accepts multiple inputs)
   --secret value       authenticate user [$SECRET]
   --debug              log debug (default: false)
   --help, -h           show help (default: false)

generate new private key

$ p2p-tun genkey
CAISIOsUwgZfa2zQ8SDX5ZVK8QH3ypx5GL8F3KLCgvIr01LD

port forward

forward remote target:port to local port.

server

$ export PRIVATE_KEY=CAISIOsUwgZfa2zQ8SDX5ZVK8QH3ypx5GL8F3KLCgvIr01LD
$ export SECRET=abcd
$ p2p-tun  server port --forward-addr 192.168.1.1:80

client

$ export SECRET=abcd
$ export SERVER_ADDR=/dns/rndz.optman.net/tcp/8888/p2p/16Uiu2HAm19Fic7qSLVVmFVe5RDzrdKrii7fcVUU7wYHXEtRTjXrw
$ p2p-tun client port --local-address :8888

$ curl localhost:8888

tun2socks

tunnel tcp/udp to remote built-in socks5 server

udp only support request/response mod, such as DNS.

server

$ export PRIVATE_KEY=CAISIOsUwgZfa2zQ8SDX5ZVK8QH3ypx5GL8F3KLCgvIr01LD
$ export SECRET=abcd
$ p2p-tun server socks

client

$ sudo ip tuntap add mode tun tun0
$ sudo ip link set dev tun0 up
$ sudo ip route add 192.168.1.0/24 dev tun0

$ export SECRET=abcd
$ export SERVER_ADDR=/dns/rndz.optman.net/tcp/8888/p2p/16Uiu2HAm19Fic7qSLVVmFVe5RDzrdKrii7fcVUU7wYHXEtRTjXrw
$ p2p-tun client tun --tun-name tun0

$ curl 192.168.1.1:80
$ dig www.github.com @192.168.1.1

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author