Comments (11)
Hi,
- Software is based on a single-threaded event-driven architecture, so read up on event loops etc.. The event loop implementation is in system/BReactor_badvpn.{h,c}.
- To work with UDP, use the existing BDatagram facility (look at system/BDatagram.h for the API).
- The tun2socks main implementation is in tun2socks/tun2socks.c. The most important functions here are:
- process_device_udp_packet (called to handle a UDP packet coming in from the TUN and needs to be sent),
- BTap_Send - use this when you receive a packet to send it into the TUN, see for example what udpgw_client_handler_received does.
- The current UDP support in tun2socks uses the custom "udpgw" server - you will need to add conditionals (e.g. in the above mentioned places) so that UDP support is provided either by udpgw or UDP Associate.
- You will need to maintain a collection of UDP "associations", and you will need to associate packets coming from TUN with a association possibly involving creation of one. Each "association" object will be responsible for a particular (LocalPort, RemotePort, LocalAddress, RemoteAddress) combination.
- Each association object will need to do the SOCKS handshaking using TCP. You can probably copy a lot of code from current socksclient/ code which is for TCP connections. It would be best to separate this code into its own module. Or maybe the existing socksclient could be extended to also do UDP Associate, your call.
- You will probably need to buffer packets within associations while you are doing the SOCKS handshaking, to prevent undesired loss.
I need to go right now, I can provide further guidance...
from badvpn.
Well, thanks your detailed guides.
I go to have a try first.
from badvpn.
Hi,
Another question: Why not use map(dictionary) (use source port or destination port as key or both) to manage connections instead of AVL tree for enhance performance of finding connection in "UdpGwClient.c Line 529"?
from badvpn.
@greatfirewall give #71 a try
from badvpn.
While waiting for #71 to get merged (any eta?) a good workaround would be using dns2socks
from badvpn.
Emm.. I had built myself product to implement this feature..
If anyone is interested, you can take a look Win2Socks.
from badvpn.
Interesting :)
from badvpn.
@greatfirewall, it is not clear to me if your product is based on tun2socks code?
from badvpn.
@greatfirewall, it is not clear to me if your product is based on tun2socks code?
No, I completely developed it myself. I am sorry to make you feel confused. :)
from badvpn.
@greatfirewall, okay good for you, thanks for the info!
from badvpn.
@ambrop72 You're welcome.
from badvpn.
Related Issues (20)
- confused me:why use an empty job for sync in listener_accept_func HOT 4
- socks5 udp doesn't work with IPv6 HOT 1
- why not using boost::asio
- 请问tun2socks透明代理udp该怎么做? HOT 2
- Forks
- Any limitations on Raspberry Pi? HOT 5
- Linux Router
- move_first_timers crash HOT 1
- BadVPN not Working Properly
- ERROR(udpgw): BConnection_Init failed HOT 8
- BADVPN ERROR
- out of UDP buffer
- Virtual netword adapter tap 9 via tun2socks. Need instruction HOT 4
- tun2socks и proxy ipv6
- Assertion failed in BReactor_badvpn.c
- How does the UdpGw daemon work? HOT 2
- tun2socks not support half-closing
- tun2socks on freebsd
- nss/ssl.h not found HOT 1
- 能否在Wiki中写一下tun2socks组件转发的UDP包结构? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from badvpn.