You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we can change the example to use the LocalAddr() method :D
typeRouterClientinterface {
AddPortMapping(
NewRemoteHoststring,
NewExternalPortuint16,
NewProtocolstring,
NewInternalPortuint16,
NewInternalClientstring,
NewEnabledbool,
NewPortMappingDescriptionstring,
NewLeaseDurationuint32,
) (errerror)
LocalAddr() net.IPGetExternalIPAddress() (
NewExternalIPAddressstring,
errerror,
)
}
//....returnclient.AddPortMapping(
"",
// External port number to expose to Internet:1234,
// Forward TCP (this could be "UDP" if we wanted that instead)."TCP",
// Internal port number on the LAN to forward to.// Some routers might not support this being different to the external// port number.1234,
// Internal address on the LAN we want to forward to.client.LocalAddr().String(),
// Enabled:true,
// Informational description for the client requesting the port forwarding."MyProgramName",
// How long should the port forward last for in seconds.// If you want to keep it open for longer and potentially across router// resets, you might want to periodically request before this elapses.3600,
)
The text was updated successfully, but these errors were encountered:
at https://github.com/huin/goupnp/blob/main/GUIDE.md
we can change the example to use the LocalAddr() method :D
The text was updated successfully, but these errors were encountered: