This repository has been archived by the owner on Jun 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
How do I use it after I get my IP through stun? #61
Comments
I try to use the following code, which is not very effective conn, err := net.Dial("udp", "140.143.226.61:3478")
if err != nil {
panic(err)
}
go func() {
for {
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
panic(err)
}
fmt.Println(buf[0:n])
}
}()
c, err := stun.NewClient(conn) |
You can use UDP and this found transport address to send data to your UDP server behind the NAT. |
Hi, you should use a de-multiplexer on your UDP "connection". The low-level example of NAT Traversal can be found at |
I've created an example, please see cmd/stun-multiplex |
Ok, I have read it, thank you for your reply. |
Note that it will work only for non-symmetric NAT. Closing for now. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think stun is cool, I tried to run the example on Readme, it worked, but how do I use UDP communication?
The text was updated successfully, but these errors were encountered: