summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go30
1 files changed, 23 insertions, 7 deletions
diff --git a/main.go b/main.go
index e87162c..d770790 100644
--- a/main.go
+++ b/main.go
@@ -43,7 +43,7 @@ func main() {
if me.portmaps == nil {
me.portmaps = NewPortmaps()
p := new(Portmap)
- p.Connect = "testing:323"
+ p.Dest = "testing:323"
me.portmaps.Append(p)
}
@@ -61,7 +61,7 @@ func main() {
if !pm.Enabled {
continue
}
- log.Info("portmap enabled for port", pm.Listen, "to", pm.Connect)
+ log.Info("portmap enabled for port", pm.Localport, "to", pm.Dest)
go gus3000(pm)
}
startHTTP()
@@ -74,7 +74,7 @@ func main() {
if !pm.Enabled {
continue
}
- log.Info("portmap enabled for port", pm.Listen, "to", pm.Connect)
+ log.Info("portmap enabled for port", pm.Localport, "to", pm.Dest)
go gus3000(pm)
}
// go NewWatchdog()
@@ -84,8 +84,8 @@ func main() {
// func doME(pm *Portmap, gus listener.Accept) {
func doME(pm *Portmap, gus net.Listener) {
- localport := int(pm.Listen)
- where := pm.Connect
+ localport := int(pm.Localport)
+ where := pm.Dest
/*
// Listen on local port 3000
@@ -113,8 +113,8 @@ func doME(pm *Portmap, gus net.Listener) {
}
func gus3000(pm *Portmap) {
- port := int(pm.Listen)
- connect := pm.Connect
+ port := int(pm.Localport)
+ connect := pm.Dest
// Listen on local port 3000
s := fmt.Sprintf("0.0.0.0:%d", port)
@@ -177,3 +177,19 @@ func handleConnection(clientConn net.Conn, where string, localport int) {
me.eventsChanged = true
log.Printf("Connection closed on port %d from client: %s to where = %s\n", localport, clientConn.RemoteAddr(), where)
}
+
+func enablePort(port int, dest string) {
+ all := me.portmaps.All()
+ for all.Scan() {
+ pm := all.Next()
+ if int(pm.Localport) == port {
+ log.Info("Found port!", port)
+ }
+ if pm.Enabled {
+ log.Info("portmap already enabled for", pm.Localport, "to", pm.Dest)
+ } else {
+ log.Info("portmap not enabled for", pm.Localport, "to", pm.Dest)
+ }
+ // go gus3000(pm)
+ }
+}