Giter Site home page Giter Site logo

Comments (6)

thebsdbox avatar thebsdbox commented on May 24, 2024
package main

import "fmt"
import "github.com/yanzay/upnp"

func main() {

upnpMan := new(upnp.Upnp)
err := upnpMan.SearchGateway()
if err != nil {
        fmt.Println(err.Error())
} else {
        fmt.Println("local ip address: ", upnpMan.LocalHost)
        fmt.Println("gateway ip address: ", upnpMan.Gateway.Host)
}

err = upnpMan.ExternalIPAddr()
if err != nil {
        fmt.Println(err.Error())
} else {
        fmt.Println("internet ip address: ", upnpMan.GatewayOutsideIP)
}

>  cat main.go                                                      upnp-master
package main

import "fmt"
import "github.com/yanzay/upnp"

func main() {

upnpMan := new(upnp.Upnp)
err := upnpMan.SearchGateway()
if err != nil {
	fmt.Println(err.Error())
} else {
	fmt.Println("local ip address: ", upnpMan.LocalHost)
	fmt.Println("gateway ip address: ", upnpMan.Gateway.Host)
}

err = upnpMan.ExternalIPAddr()
if err != nil {
	fmt.Println(err.Error())
} else {
	fmt.Println("internet ip address: ", upnpMan.GatewayOutsideIP)
}

mapping := new(upnp.Upnp)
if err := mapping.AddPortMapping(22, 55789, "TCP"); err == nil {
	fmt.Println("success !")
	// remove port mapping in gatway
//	mapping.Reclaim()
} else {
	fmt.Println("fail !")
}

}

^ earlier testing (needs to put it somewhere)

from kube-vip.

displague avatar displague commented on May 24, 2024

I'm adding relevant keywords so this can be better found in Google searches:
https://tools.ietf.org/html/rfc6970
Universal Plug and Play (UPnP), Internet Gateway Device - Port Control Protocol Interworking Function, (IGD-PCP IWF)

from kube-vip.

displague avatar displague commented on May 24, 2024

I ran this PoC code (with the router port 22 and a 100s port removal). This is awesome!

from kube-vip.

displague avatar displague commented on May 24, 2024

A uPNP CCM could query the network (SSDP) to find out if a node is no longer available (to remove it from the cluster), https://www.electricmonk.nl/log/2016/07/05/exploring-upnp-with-python/

from kube-vip.

thebsdbox avatar thebsdbox commented on May 24, 2024

Attempted to implement this only to be hit with a brick wall ->
VIP 192.168.0.201
Host 192.168.0.45

image

I can't advertise the VIP to the router, only the address of the host itself

from kube-vip.

thebsdbox avatar thebsdbox commented on May 24, 2024

Merged as of #96

from kube-vip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.