Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Time.UnixNano() requires all 64 bits but Record stores only 56, so ro…

…und it to microseconds
  • Loading branch information...
commit c5f466e2c2085351c09a2c5ebaef857909d0cfbf 1 parent 0267ac1
@temoto authored
View
2  oakmole-cat/main.go
@@ -97,7 +97,7 @@ func main() {
return
}
- t := time.Unix(int64(record.Timestamp/1e9), int64(record.Timestamp%1e9))
+ t := time.Unix(int64(record.Timestamp/1e6), int64(record.Timestamp%1e6))
s := fmt.Sprintf("%s: %s\n\n", t.Format(time.RFC3339), string(record.Body))
os.Stdout.WriteString(s)
case <-stopWriter:
View
2  oakmole-radar/net.go
@@ -80,7 +80,7 @@ func connectionHandler(conn *net.TCPConn, out chan *oakmole.Record) {
buffer = buffer[:totalSize]
record := &oakmole.Record{
- Timestamp: uint64(timeBegin.UnixNano()),
+ Timestamp: uint64(timeBegin.UnixNano() / 1000),
LocalIP: addrLocal.IP,
RemoteIP: addrRemote.IP,
Body: buffer,
View
4 oakmole/storage_test.go
@@ -3,11 +3,13 @@ package oakmole
import (
"net"
"testing"
+ "time"
)
func Test01(t *testing.T) {
r1 := &Record{
- 0x010203, net.ParseIP("4.4.5.5"), net.ParseIP("2.3.3.1"),
+ uint64(time.Now().UnixNano() / 1000),
+ net.ParseIP("4.4.5.5"), net.ParseIP("2.3.3.1"),
[]byte("host12"), []byte("bodyzzz"),
}
b, err := r1.Marshal()
Please sign in to comment.
Something went wrong with that request. Please try again.