nadoo / glider

glider is a forward proxy with multiple protocols support, and also a dns/dhcp server with ipset management features(like dnsmasq).
GNU General Public License v3.0
3.1k stars 422 forks source link

TUN/TAP (VPN) support #120

Open ValdikSS opened 5 years ago

ValdikSS commented 5 years ago

Hi, just leaving the links for useful software and libraries to convert TUN/TAP to Socks5/HTTP proxy (OpenVPN as proxy). Hope you'll find them useful.

https://github.com/russdill/tunsocks tunsocks is a user-level SOCKS, HTTP, and port forwarding proxy for use with VPNs that typically interact with tun devices. Rather than passing bytes to and from the tun device, they can pass the data to and from this user-level program. tunsocks is implemented using lwIP.

https://github.com/cernekee/ocproxy ocproxy is a user-level SOCKS and port forwarding proxy for OpenConnect based on lwIP. When using ocproxy, OpenConnect only handles network activity that the user specifically asks to proxy, so the VPN interface no longer “hijacks” all network traffic on the host.

phantomcraft commented 5 years ago

TUN/TAP with IPv6 would be very good.

Another useful feature would be support for listening on Unix Sockets, together with TUN/TAP could provide networking for containers without using network stacks with veth pairs and iptable rules.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

nil0x42 commented 2 years ago

Such feature would be great to have !

something like:

forward=tun-interface://tun0
phantomcraft commented 2 years ago

Maybe I would pay for this feature.

nadoo commented 2 years ago

Such feature would be great to have !

something like:

forward=tun-interface://tun0

Hi @nil0x42 , I guess you just want to forward requests via an existing tun interface? then you can run glider like:

glider -verbose -listen :8443 -interface=tun0
nil0x42 commented 2 years ago

Such feature would be great to have ! something like:

forward=tun-interface://tun0

Hi @nil0x42 , I guess you just want to forward requests via an existing tun interface? then you can run glider like:

glider -verbose -listen :8443 -interface=tun0

Actually i want to forward requests via multiple existing tun interfaces, with rr strategy

strategy=rr
forward=tun0
forward=tun1
forward=tun2
nadoo commented 2 years ago

Such feature would be great to have !

something like:


forward=tun-interface://tun0

Hi @nil0x42 , I guess you just want to forward requests via an existing tun interface? then you can run glider like:


glider -verbose -listen :8443 -interface=tun0

Actually i want to forward requests via multiple existing tun interfaces, with rr strategy


strategy=rr

forward=tun0

forward=tun1

forward=tun2

How about this?

verbose
listen=:8443
strategy=rr
forward=direct://#interface=tun0
forward=direct://#interface=tun1
forward=direct://#interface=tun2
nadoo commented 2 years ago

Hi @nil0x42 , actually the following config is working start from the version v0.15.0:

verbose
listen=:8443
strategy=rr
forward=direct://#interface=tun0
forward=direct://#interface=tun1
forward=direct://#interface=tun2
nil0x42 commented 2 years ago

Okay, thank you !

nil0x42 commented 2 years ago

Hi ! I've tried this technique with vlan interfaces (secondary ips), and it doesn't work: $ cat glider.conf

listen=:8444
strategy=rr
forward=direct://#interface=eth0:0
forward=direct://#interface=eth0:1
forward=direct://#interface=eth0:2

$ glider --config glider.conf

2022/03/19 20:24:29 log.go:35: route ip+net: no such network interface: eth0:0

EDIT:

as vlan interface name is not recognized, i've tried directly setting each source ip as interface and it works. For example:

listen=:8444
strategy=rr
forward=direct://#interface=191.122.51.3
forward=direct://#interface=191.122.51.4
forward=direct://#interface=191.122.51.5
nadoo commented 2 years ago

Hi ! I've tried this technique with vlan interfaces (secondary ips), and it doesn't work: $ cat glider.conf

listen=:8444
strategy=rr
forward=direct://#interface=eth0:0
forward=direct://#interface=eth0:1
forward=direct://#interface=eth0:2

$ glider --config glider.conf

2022/03/19 20:24:29 log.go:35: route ip+net: no such network interface: eth0:0

You can use the interface names showed by ip add, a vlan interface eth0.1 should work, but not the sub interface eth0:1