diff options
| author | Jeff Carr <[email protected]> | 2025-03-12 07:44:35 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-12 09:36:15 -0500 | 
| commit | 24962f3524ab05bb990dd8f6f7c876b02c279880 (patch) | |
| tree | ad244709370f69a60bf95a03403960f195488386 | |
| parent | a024c9ece14d3097b3f72f2dc831444afd695d86 (diff) | |
| -rw-r--r-- | main.go | 28 | 
1 files changed, 21 insertions, 7 deletions
@@ -109,6 +109,7 @@ func doME(pm *Portmap, gus net.Listener) {  		src, err := gus.Accept()  		if err != nil {  			log.Printf("Failed to accept client connection: %v\n", err) +			pm.Enabled = false  			return  		} @@ -121,19 +122,22 @@ func doME(pm *Portmap, gus net.Listener) {  		// Read one line  		line, err := reader.ReadString('\n')  		if err != nil { -			log.Info("Error reading line:", err) -			return +			log.Info("gus src", src.RemoteAddr(), "read error:", err) +			continue +		} +		if !strings.HasPrefix(line, "/me") { +			log.Printf("gus Received %d invalid bytes\n", len(line)) +			continue  		} -		log.Info("gus got Received:", line)  		parts := strings.Fields(line)  		if len(parts) != 3 { -			return +			continue  		}  		if parts[0] != "/me" { -			return +			continue  		}  		if parts[1] != "hostname" { -			return +			continue  		}  		hostname := parts[2]  		msg := fmt.Sprintf("got hostname %s for %s", hostname, src.RemoteAddr()) @@ -142,7 +146,17 @@ func doME(pm *Portmap, gus net.Listener) {  		if hostname == "framebook.wit.com" {  			// Handle the connection in a separate goroutine -			go handleConnection(src, pm.Dest, int(pm.Localport)) +			log.Info("RUNNING DIAL") +			dest, err := net.Dial("tcp", where) +			if err != nil { +				log.Printf("Failed to connect to %s %v", where, err) +				continue +			} +			defer dest.Close() + +			log.Info("IOCOPY START") +			ioCopy(src, dest) +			log.Info("IOCOPY END")  		}  	}  }  | 
