move logging to journalctl + start trying to debug missing bytes
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
17e5b73aa4
commit
9070d87fba
|
@ -11,9 +11,8 @@ import "math/rand"
|
||||||
import "net"
|
import "net"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
import "strings"
|
import "strings"
|
||||||
import "log"
|
import log "github.com/sirupsen/logrus"
|
||||||
// import "fmt"
|
import "github.com/wercker/journalhook"
|
||||||
// import "time"
|
|
||||||
|
|
||||||
import "git.wit.com/jcarr/shell"
|
import "git.wit.com/jcarr/shell"
|
||||||
|
|
||||||
|
@ -22,7 +21,7 @@ import "git.wit.com/jcarr/shell"
|
||||||
|
|
||||||
import "github.com/miekg/dns"
|
import "github.com/miekg/dns"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
// import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
const MIN = 1
|
const MIN = 1
|
||||||
const MAX = 100
|
const MAX = 100
|
||||||
|
@ -44,7 +43,8 @@ func GetRemoteAddr(conn net.TCPConn) string {
|
||||||
// Then each hostname is verified with DNSSEC
|
// Then each hostname is verified with DNSSEC
|
||||||
//
|
//
|
||||||
func HandleConnection(conn *net.TCPConn) {
|
func HandleConnection(conn *net.TCPConn) {
|
||||||
spew.Dump(conn)
|
journalhook.Enable()
|
||||||
|
// spew.Dump(conn)
|
||||||
// ipv6client := GetRemoteAddr(c)
|
// ipv6client := GetRemoteAddr(c)
|
||||||
ipv6client := conn.RemoteAddr()
|
ipv6client := conn.RemoteAddr()
|
||||||
log.Println("Serving to %s as the IPv6 client", ipv6client)
|
log.Println("Serving to %s as the IPv6 client", ipv6client)
|
||||||
|
@ -80,7 +80,16 @@ func HandleConnection(conn *net.TCPConn) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
f, _ := conn.File()
|
||||||
|
// shell.SetStdout(f)
|
||||||
|
// shell.SpewOn() // turn this on if you want to look at the process exit states
|
||||||
|
|
||||||
|
// send all log() output to systemd journalctl
|
||||||
|
// shell.UseJournalctl()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
defer shell.SetStdout(os.Stdout)
|
||||||
|
defer conn.Close()
|
||||||
netData, err := newreader.ReadString('\n')
|
netData, err := newreader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
@ -95,24 +104,19 @@ func HandleConnection(conn *net.TCPConn) {
|
||||||
|
|
||||||
if (temp == "list") {
|
if (temp == "list") {
|
||||||
log.Println("Should run list here")
|
log.Println("Should run list here")
|
||||||
f, _ := conn.File()
|
|
||||||
shell.SetStdout(f)
|
shell.SetStdout(f)
|
||||||
shell.Run("ls /tmp/")
|
shell.Run("/root/bin/list.testing.com")
|
||||||
// close(f)
|
|
||||||
shell.SetStdout(os.Stdout)
|
shell.SetStdout(os.Stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (temp == "cpuinfo") {
|
if (temp == "cpuinfo") {
|
||||||
log.Println("Should cat /proc/cpuinfo")
|
log.Println("Should cat /proc/cpuinfo")
|
||||||
// f, _ := conn.File()
|
shell.SetStdout(f)
|
||||||
// shell.SetStdout(f)
|
|
||||||
shell.Run("cat /proc/cpuinfo")
|
shell.Run("cat /proc/cpuinfo")
|
||||||
// close(f)
|
|
||||||
shell.SetStdout(os.Stdout)
|
shell.SetStdout(os.Stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
result := strconv.Itoa(random()) + "\n"
|
result := strconv.Itoa(random()) + "\n"
|
||||||
conn.Write([]byte(string(result)))
|
conn.Write([]byte(string(result)))
|
||||||
}
|
}
|
||||||
conn.Close()
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue