lastest changes

This commit is contained in:
2021-01-20 13:05:04 +04:00
parent a71905d698
commit 16fb7ca42f
20 changed files with 152 additions and 1 deletions

0
server/container.go Executable file → Normal file
View File

28
server/mDNS.go Normal file
View 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

Binary file not shown.

23
server/portforwarding.go Normal file
View 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
View File