-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could you specify some examples? #36
Comments
Did you see the examples in https://github.com/huin/goupnp/blob/master/example/example_test.go ? As for examples that do something else, I'd have to refer to the UPnP docs for the specific device types. |
Yep I saw them... I just thought that having some sort of docs could help a lot |
Sorry for the delayed response. Could you be more specific about how the documentation could be improved/added? What problem you're trying to solve that's not being served? https://pkg.go.dev/github.com/huin/goupnp contains the generated docs from this source, including the README. One place that I know that the docs are lacking is that the packages under Those generated docs themselves refer to the UPnP standards website (e.g for InternetGatewayDevice), which aren't the most readable docs, but I can't claim to have any better information or knowledge than those documents provide. For context: I'm not a UPnP expert by any stretch, I just created this library for my own purposes once, ended up not needing it, but maintaining it from time to time as people have made contributions. |
Yea no worries! I just became interested in the UPnP protocol and wanted to learn how to use it (like, I still don't understand what's the difference between internetgateway1 and internetgateway2 ahahahah XD ) and your rep seems quite popular so I wanted to try it out... What I meant for "example" is just some sort of "hello world" string sent from 1 PC to an other in LAN (or WAN) to demonstrate the communication between 2 machines. (like a client.go that when it's run on 2 PC in the same LAN, they automatically (or by just specifying the IP address) connect) I know it's very basic and your code is capable of much more complex things but this could be a way for the thousands of people just like me that want to know something about UPnP connection... and only after that, study all the possible use cases. whatever you decide to do, thanks for the consideration p.s. I know that when you are into something everything seems easy, but for the eye of an outsider like me this is some really weird stuff XD |
Reading your example for wanting to send a string sent from one PC on a LAN to another on the same LAN, UPnP (and therefore If you were wanting to talk between LANs without a server on the open Internet to relay between them (i.e peer-to-peer), you might need to use the However, I would still refer back to the UPnP standards/specs/documentation. I would rather not repeat documentation that specifies what the UPnP stuff does (i.e the semantics of various method calls in this library). Two things that might be worth amending the docs on for
What do you think of those changes? TBH, this library is somewhat low level and could stand a lot of improvement. Most peoples' use cases would be better served by a higher level package which takes care of using this library to talk to the router, but presents a simpler interface to "just forward a port" and "get the external IP address". |
Oh yep i definitely meant a sort of peer to peer "hello world" example between 2 LANs...
my problem as a beginner is just that it's very difficult to have a simple working example for testing and learning step by step (I'm not asking you do write it for me, I just wanted to report a problem that I found... Probably this rep is too technical for me ahahah)
yep this could be helpful, the ones linked are quite long and sooo in depth that it's difficult to have a glance at it
For me it would be very good, but I'm a beginner for this subject and maybe you want to make your rep for technicians...
yea you are probably right |
Sorry for the delay, this stuff tends to wait until the weekend when I have some free time. I've written up https://github.com/huin/goupnp/blob/master/GUIDE.md - let me know if that's helpful :) |
And as for a higher level library, I don't know of any offhand. That said, looking for what packages import Quite a lot seem to be crypto-currency related things, and I certainly can't vouch for anyone else's code, but a lot of them do see to provide a |
ok thank you a lot! even thought I'm am still unable to make it work (it says it seems that the example just checks if there is some upnp service on the LAN and if there is none it exits while I am trying to start the listening for other clients online so that they can then communicate... anyway thanks for the help!
thanks for the link I'll take a look :) |
Yeah, the example is pretty limited, but hopefully it's a good starting point. There's no clearly always-right answer for if there are multiple router devices on the network, it could be that a single router presents multiple devices and you could use any of them. So if there are multiple, experiment with printing the model name and IP address of each to work out what's going on. If there are no devices, then either your router doesn't implement UPnP, or it's switched off. UPnP is often regarded as a potential security threat if left running, so it's not uncommon to want to switch it off. Happy coding :) |
I see that there are tons of different functions and I really don't know where to start implementing a simple "hello world" connections between 2 peers
Thanks
The text was updated successfully, but these errors were encountered: