Fix formatting issues

This commit is contained in:
Leonid Bugaev
2015-08-18 17:28:09 +03:00
parent d6c776fa0c
commit b53fba0415
5 changed files with 16 additions and 17 deletions
+1 -1
View File
@@ -1,9 +1,9 @@
package main
import (
"bytes"
"io"
"time"
"bytes"
)
// Start initialize loop for sending data from inputs to outputs
+1 -1
View File
@@ -1,9 +1,9 @@
package main
import (
"bufio"
"log"
"os"
"bufio"
"strconv"
"time"
)
+3 -3
View File
@@ -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.
+2 -2
View File
@@ -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
+9 -10
View File
@@ -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
}
}