Comments (7)
Thx, I am working on this function.
Server before handle udp packet, it should check the src if prepared by a tcp connection
from socks5.
This is nothing about LAN or WLAN, it just care DST.ADDR and DST.PORT.
Before send UDP data, client send DST.ADDR and DST.PORT
with a TCP connection, so we can store DST.ADDR and DST.PORT
and compare it with src of UDP
when UDP data come.
But If server get zero:zero
DST.ADDR and DST.PORT
with a TCP connection, how to limit or compare it with src of UDP
when UDP data come.
https://stackoverflow.com/questions/62283351/how-to-use-socks-5-proxy-with-tidudpclient-properly
This link said:
If the requested Host/Port is all zeros, the relay should simply use the Host/Port that sent the request.
That means server should assumeDST.ADDR and DST.PORT
issrc of TCP
? [a]
this[a] is what I did, but looks like some software don't do with this. like proxycap do:
proxycap(src1) -- tcp --zero DST.ADDR and DST.PORT--> socks5 server
proxycap(src2) -- udp --socks5 server
If the stackoverflow link is correct, src2 should equal with src1
from socks5.
Yes, DST.ADDR and DST.PORT matter.
But if the client is in a lan, it does not have a public ip. When it wants to negotiate with the server, it can only fill local ip and port into DST.ADDR and DST.PORT. After negotiation, when udp packets come, the server would get a public ip which is mapped by a NAT device like a Router instead of the local ip which the client filled in during the negotiation. So I still can not compare those 2 address.
Does this make sense?
Or in this situation, the client should use zero:zero DST.ADDR and DST.PORT ?
from socks5.
https://github.com/txthinking/socks5/blob/master/server.go#L43
If set LimitUDP with true, server will check incoming src if it has been sent by a prev tcp connection
from socks5.
Yes, DST.ADDR and DST.PORT matter.
But if the client is in a lan, it does not have a public ip. When it wants to negotiate with the server, it can only fill local ip and port into DST.ADDR and DST.PORT. After negotiation, when udp packets come, the server would get a public ip
Yes, this is NAT's work. socks5 server only can handle incoming src, https://en.wikipedia.org/wiki/Network_address_translation
And more, socks5 server is also a NAT too, this library implements Symmetric NAT
from socks5.
Yes, DST.ADDR and DST.PORT matter.
But if the client is in a lan, it does not have a public ip. When it wants to negotiate with the server, it can only fill local ip and port into DST.ADDR and DST.PORT. After negotiation, when udp packets come, the server would get a public ipYes, this is NAT's work. socks5 server only can handle incoming src, https://en.wikipedia.org/wiki/Network_address_translation
And more, socks5 server is also a NAT too, this library implements Symmetric NAT
The situation mentioned by @Danieldachao just like this:
Application Client - SOCKS Client - NAT - SOCKS Server - Application Server
Then the SOCKS Client
can only set the UDP Association DST.ADDR
and DST.PORT
with zero because can not foresee the NAT's behavior. There is no problem. The problem is how SOCKS Server relate a incoming udp packet with current tcp connection when a lot of SOCKS Clients request the UDP Association
command concurrent ?
After my deep thinking, we can set the reply of UDP Association
command with a dynamic BND.PORT
to solve. Then SOCKS Server can relate the incoming udp packet with a TCP connection correct.
from socks5.
Server.LimitUDP
from socks5.
Related Issues (13)
- socks5 proxy over socks5 proxy
- [feature request] multiple user/pass or custom authentication handler HOT 2
- When using udp connection, some VPS servers can fail due to IP conversion. HOT 1
- Send UDP ASSOCIATE command, DST.ADDR and DST.PORT should use zeros. HOT 2
- 关于参数不太理解 HOT 1
- 报错Invalid Version HOT 2
- Is it possible to customize tcp and udp Dial? HOT 2
- udp associate port and address have the problem HOT 28
- custom handler?
- udp response destaddress and destport fault HOT 5
- A UDP association terminates when the TCP connection that the UDP ASSOCIATE request arrived on terminates HOT 4
- NAT1 Full cone question 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 socks5.