golang で UPnP をサポートするルーターを検出し、ルーターの外部ポートをローカル PC の転送ポートにマップする / Detects routers that support UPnP and maps the router’s external ports to forward ports on the local PC with golang

下記のパッケージで機能が提供されています:

  • https://github.com/huin/goupnp
  • https://gitlab.com/NebulousLabs/go-upnp
  • https://gitlab.com/NebulousLabs/fastrand

gitlab.com/NebulousLabs/go-upnp は、このままでは
現在の github.com/huin/goupnp とマッチしないので
ローカルの upnp/upnp.go に必要な箇所をコピーして修正して使用しました。

最低限のソースのみ

upnp/upnp.go:

main.go:

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です