lastest changes
This commit is contained in:
0
server/container.go
Executable file → Normal file
0
server/container.go
Executable file → Normal file
28
server/mDNS.go
Normal file
28
server/mDNS.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/pion/mdns"
|
||||
"golang.org/x/net/ipv4"
|
||||
)
|
||||
|
||||
func main() {
|
||||
server, err := zeroconf.Register("GoZeroconf", "_workstation._tcp", "local.", 42424, []string{"txtv=0", "lo=1", "la=2"}, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer server.Shutdown()
|
||||
|
||||
// Clean exit.
|
||||
sig := make(chan os.Signal, 1)
|
||||
signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
|
||||
select {
|
||||
case <-sig:
|
||||
// Exit by user
|
||||
case <-time.After(time.Second * 120):
|
||||
// Exit by timeout
|
||||
}
|
||||
|
||||
log.Println("Shutting down.")
|
||||
}
|
||||
BIN
server/portforwarding
Executable file
BIN
server/portforwarding
Executable file
Binary file not shown.
23
server/portforwarding.go
Normal file
23
server/portforwarding.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jackpal/gateway"
|
||||
natpmp "github.com/jackpal/go-nat-pmp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gatewayIP, err := gateway.DiscoverGateway()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
client := natpmp.NewClient(gatewayIP)
|
||||
response, err := client.GetExternalAddress()
|
||||
if err != nil {
|
||||
fmt.Print(err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("External IP address: %v\n", response.ExternalIPAddress)
|
||||
}
|
||||
0
server/server.go
Executable file → Normal file
0
server/server.go
Executable file → Normal file
Reference in New Issue
Block a user