huin/goupnp

port mapping?

james-lawrence opened this issue · 3 comments

I was wondering if this library supports port mapping? not too familiar with upnp but I'm basically just looking for the ability to setup an open port through the router. I tried searching for urn:schemas-upnp-org:service:WANIPConnection:1 and couldn't find any references but not sure if I'm ever searching for the right thing =)

huin commented

I wouldn't count myself an expert on UPnP. From my limited understanding, there are facilities to add port mappings in IGD1 and IGD2 (Intenet Gateway Device):

IGD1:
https://godoc.org/github.com/huin/goupnp/dcps/internetgateway1#WANIPConnection1.AddPortMapping
https://godoc.org/github.com/huin/goupnp/dcps/internetgateway1#WANPPPConnection1.AddPortMapping

IGD2:
https://godoc.org/github.com/huin/goupnp/dcps/internetgateway2#WANIPConnection1.AddPortMapping
https://godoc.org/github.com/huin/goupnp/dcps/internetgateway2#WANIPConnection2.AddPortMapping
https://godoc.org/github.com/huin/goupnp/dcps/internetgateway2#WANPPPConnection1.AddPortMapping

I think it depends which of those is supported by the UPnP device in question -- and its configuration. You might need to try all of them. The last router I tried this on supported IGD1 and WANPPP, if I remember correctly.

Yeah I went through each other and found the one that worked. (also happens that my router had it disabled by default) thanks. =)

huin commented

Excellent, glad that's working :)