mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Adjust package order (#487)
* format package order * format package order * format package order * format package order and format code by fmt
This commit is contained in:
+4
-2
@@ -3,12 +3,14 @@ package main
|
|||||||
import (
|
import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"github.com/mattbaird/elastigo/lib"
|
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
//"regexp"
|
//"regexp"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
|
|
||||||
|
"github.com/mattbaird/elastigo/lib"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ESUriErorr struct{}
|
type ESUriErorr struct{}
|
||||||
|
|||||||
@@ -24,8 +24,9 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// requestID -> originalToken
|
// requestID -> originalToken
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
_ "log"
|
_ "log"
|
||||||
"net"
|
"net"
|
||||||
@@ -15,6 +14,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHTTPClientURLPort(t *testing.T) {
|
func TestHTTPClientURLPort(t *testing.T) {
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHTTPModifierWithoutConfig(t *testing.T) {
|
func TestHTTPModifierWithoutConfig(t *testing.T) {
|
||||||
|
|||||||
+2
-1
@@ -3,10 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func prettifyHTTP(p []byte) []byte {
|
func prettifyHTTP(p []byte) []byte {
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -9,6 +8,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHTTPInput(t *testing.T) {
|
func TestHTTPInput(t *testing.T) {
|
||||||
|
|||||||
+2
-1
@@ -2,9 +2,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/Shopify/sarama/mocks"
|
"github.com/Shopify/sarama/mocks"
|
||||||
"log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// KafkaInput is used for recieving Kafka messages and
|
// KafkaInput is used for recieving Kafka messages and
|
||||||
|
|||||||
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/Shopify/sarama/mocks"
|
"github.com/Shopify/sarama/mocks"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInputKafkaRAW(t *testing.T) {
|
func TestInputKafkaRAW(t *testing.T) {
|
||||||
|
|||||||
+3
-2
@@ -1,11 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
raw "github.com/buger/goreplay/raw_socket_listener"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
|
raw "github.com/buger/goreplay/raw_socket_listener"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RAWInput used for intercepting traffic for given address
|
// RAWInput used for intercepting traffic for given address
|
||||||
|
|||||||
+2
-1
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
@@ -19,6 +18,8 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
const testRawExpire = time.Millisecond * 200
|
const testRawExpire = time.Millisecond * 200
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Shopify/sarama"
|
|
||||||
"github.com/buger/goreplay/proto"
|
"github.com/buger/goreplay/proto"
|
||||||
|
|
||||||
|
"github.com/Shopify/sarama"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KafkaConfig should contains required information to
|
// KafkaConfig should contains required information to
|
||||||
|
|||||||
+2
-1
@@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
@@ -12,6 +11,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fakeServiceCb func(string, int, []byte)
|
type fakeServiceCb func(string, int, []byte)
|
||||||
|
|||||||
+5
-3
@@ -2,13 +2,15 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/Shopify/sarama"
|
|
||||||
"github.com/Shopify/sarama/mocks"
|
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
|
|
||||||
|
"github.com/Shopify/sarama"
|
||||||
|
"github.com/Shopify/sarama/mocks"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KafkaOutput is used for sending payloads to kafka in JSON format.
|
// KafkaOutput is used for sending payloads to kafka in JSON format.
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/Shopify/sarama/mocks"
|
"github.com/Shopify/sarama/mocks"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestOutputKafkaRAW(t *testing.T) {
|
func TestOutputKafkaRAW(t *testing.T) {
|
||||||
|
|||||||
+5
-4
@@ -18,6 +18,7 @@ package proto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/buger/goreplay/byteutils"
|
"github.com/buger/goreplay/byteutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -348,18 +349,18 @@ func Path(payload []byte) []byte {
|
|||||||
|
|
||||||
if eol > 0 {
|
if eol > 0 {
|
||||||
if end == -1 || eol < end {
|
if end == -1 || eol < end {
|
||||||
return payload[start : start + eol]
|
return payload[start : start+eol]
|
||||||
}
|
}
|
||||||
} else { // support for legacy clients
|
} else { // support for legacy clients
|
||||||
eol = bytes.IndexByte(payload[start:], '\n')
|
eol = bytes.IndexByte(payload[start:], '\n')
|
||||||
|
|
||||||
if eol > 0 && (end == - 1 || eol < end) {
|
if eol > 0 && (end == -1 || eol < end) {
|
||||||
return payload[start : start + eol]
|
return payload[start : start+eol]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if end < 0 {
|
if end < 0 {
|
||||||
return payload[start: len(payload)]
|
return payload[start:len(payload)]
|
||||||
}
|
}
|
||||||
|
|
||||||
return payload[start : start+end]
|
return payload[start : start+end]
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"github.com/google/gopacket"
|
|
||||||
"github.com/google/gopacket/layers"
|
|
||||||
"github.com/google/gopacket/pcap"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
@@ -29,6 +25,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
|
|
||||||
|
"github.com/google/gopacket"
|
||||||
|
"github.com/google/gopacket/layers"
|
||||||
|
"github.com/google/gopacket/pcap"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = fmt.Println
|
var _ = fmt.Println
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import (
|
|||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"github.com/buger/goreplay/proto"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/buger/goreplay/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = log.Println
|
var _ = log.Println
|
||||||
|
|||||||
Reference in New Issue
Block a user