From b53fba041547399f2eacdda8582795cfec0c9487 Mon Sep 17 00:00:00 2001 From: Leonid Bugaev Date: Tue, 18 Aug 2015 17:28:09 +0300 Subject: [PATCH] Fix formatting issues --- emitter.go | 2 +- input_file.go | 2 +- input_raw.go | 6 +++--- output_file.go | 4 ++-- protocol.go | 19 +++++++++---------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/emitter.go b/emitter.go index 40875bc..00ba070 100644 --- a/emitter.go +++ b/emitter.go @@ -1,9 +1,9 @@ package main import ( + "bytes" "io" "time" - "bytes" ) // Start initialize loop for sending data from inputs to outputs diff --git a/input_file.go b/input_file.go index f1a057b..840c5d7 100644 --- a/input_file.go +++ b/input_file.go @@ -1,9 +1,9 @@ package main import ( + "bufio" "log" "os" - "bufio" "strconv" "time" ) diff --git a/input_raw.go b/input_raw.go index 3bf882b..8c096c6 100644 --- a/input_raw.go +++ b/input_raw.go @@ -10,9 +10,9 @@ import ( // RAWInput used for intercepting traffic for given address type RAWInput struct { - data chan *raw.TCPMessage - address string - expire time.Duration + data chan *raw.TCPMessage + address string + expire time.Duration } // NewRAWInput constructor for RAWInput. Accepts address with port as argument. diff --git a/output_file.go b/output_file.go index e8b0d86..5ccc93c 100644 --- a/output_file.go +++ b/output_file.go @@ -8,8 +8,8 @@ import ( // FileOutput output plugin type FileOutput struct { - path string - file *os.File + path string + file *os.File } // NewFileOutput constructor for FileOutput, accepts path diff --git a/protocol.go b/protocol.go index 5d97eb7..1705f58 100644 --- a/protocol.go +++ b/protocol.go @@ -1,15 +1,15 @@ package main import ( - "strconv" "bytes" - "encoding/hex" "crypto/rand" + "encoding/hex" + "strconv" ) const ( - RequestPayload = '1' - ResponsePayload = '2' + RequestPayload = '1' + ResponsePayload = '2' ReplayedResponsePayload = '3' ) @@ -27,8 +27,8 @@ var payloadSeparator = "\nšŸµšŸ™ˆšŸ™‰\n" func payloadScanner(data []byte, atEOF bool) (advance int, token []byte, err error) { if atEOF && len(data) == 0 { - return 0, nil, nil - } + return 0, nil, nil + } if i := bytes.Index(data, []byte(payloadSeparator)); i >= 0 { // We have a full newline-terminated line. @@ -36,12 +36,11 @@ func payloadScanner(data []byte, atEOF bool) (advance int, token []byte, err err } if atEOF { - return len(data), data, nil + return len(data), data, nil } - return 0, nil, nil + return 0, nil, nil } - // Timing is request start or round-trip time, depending on payloadType func payloadHeader(payloadType byte, uuid []byte, timing int64) (header []byte) { sTime := strconv.FormatInt(timing, 10) @@ -82,4 +81,4 @@ func isOriginPayload(payload []byte) bool { func isRequestPayload(payload []byte) bool { return payload[0] == RequestPayload -} \ No newline at end of file +}