This commit is contained in:
Leonid Bugaev
2017-09-14 22:37:34 +05:00
parent 0f8e2f2d52
commit 08efdef37a
5 changed files with 11 additions and 47 deletions
+2 -2
View File
@@ -15,8 +15,8 @@ RUN wget http://www.tcpdump.org/release/libpcap-1.7.4.tar.gz && tar xzf libpcap-
RUN go get github.com/google/gopacket
RUN go get -u github.com/golang/lint/golint
WORKDIR /go/src/github.com/buger/goreplay/
ADD . /go/src/github.com/buger/goreplay/
WORKDIR /go/src/github.com/buger/gor-pro/
ADD . /go/src/github.com/buger/gor-pro/
RUN wget http://archive.apache.org/dist/commons/io/binaries/commons-io-2.4-bin.tar.gz && tar xzf commons-io-2.4-bin.tar.gz && cd commons-io-2.4 && mv commons-io-2.4.jar /tmp/
RUN wget http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.9-bin.tar.gz && tar xzf commons-codec-1.9-bin.tar.gz
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"time"
"github.com/buger/gor-pro/proto"
raw "github.com/buger/goreplay/raw_socket_listener"
raw "github.com/buger/gor-pro/raw_socket_listener"
)
// RAWInput used for intercepting traffic for given address
+6 -30
View File
@@ -106,11 +106,7 @@ func TestRAWInputNoKeepAlive(t *testing.T) {
originAddr := listener.Addr().String()
<<<<<<< HEAD
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http")
=======
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "")
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http", "")
defer input.Close()
output := NewTestOutput(func(data []byte) {
@@ -156,11 +152,7 @@ func TestRAWInputIPv6(t *testing.T) {
var respCounter, reqCounter int64
<<<<<<< HEAD
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http")
=======
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "")
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http", "")
defer input.Close()
output := NewTestOutput(func(data []byte) {
@@ -211,11 +203,7 @@ func TestInputRAW100Expect(t *testing.T) {
originAddr := strings.Replace(origin.Listener.Addr().String(), "[::]", "127.0.0.1", -1)
<<<<<<< HEAD
input := NewRAWInput(originAddr, EnginePcap, true, time.Second, "", "http")
=======
input := NewRAWInput(originAddr, EnginePcap, true, time.Second, "", "")
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
input := NewRAWInput(originAddr, EnginePcap, true, time.Second, "", "http", "")
defer input.Close()
// We will use it to get content of raw HTTP request
@@ -278,11 +266,7 @@ func TestInputRAWChunkedEncoding(t *testing.T) {
}))
originAddr := strings.Replace(origin.Listener.Addr().String(), "[::]", "127.0.0.1", -1)
<<<<<<< HEAD
input := NewRAWInput(originAddr, EnginePcap, true, time.Second, "", "http")
=======
input := NewRAWInput(originAddr, EnginePcap, true, time.Second, "", "")
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
input := NewRAWInput(originAddr, EnginePcap, true, time.Second, "", "http", "")
defer input.Close()
replay := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -346,11 +330,7 @@ func TestInputRAWLargePayload(t *testing.T) {
}))
originAddr := strings.Replace(origin.Listener.Addr().String(), "[::]", "127.0.0.1", -1)
<<<<<<< HEAD
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http")
=======
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "")
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http", "")
defer input.Close()
replay := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
@@ -395,11 +375,7 @@ func BenchmarkRAWInput(b *testing.B) {
var respCounter, reqCounter int64
<<<<<<< HEAD
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http")
=======
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "")
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
input := NewRAWInput(originAddr, EnginePcap, true, testRawExpire, "", "http", "")
defer input.Close()
output := NewTestOutput(func(data []byte) {
+1 -5
View File
@@ -180,11 +180,7 @@ func TestTokenMiddleware(t *testing.T) {
fromAddr := strings.Replace(from.Listener.Addr().String(), "[::]", "127.0.0.1", -1)
// Catch traffic from one service
<<<<<<< HEAD
input := NewRAWInput(fromAddr, EnginePcap, true, testRawExpire, "", "http")
=======
input := NewRAWInput(fromAddr, EnginePcap, true, testRawExpire, "", "")
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
input := NewRAWInput(fromAddr, EnginePcap, true, testRawExpire, "", "http", "")
defer input.Close()
// And redirect to another
+1 -9
View File
@@ -96,12 +96,7 @@ const (
EnginePcapFile
)
// NewListener creates and initializes new Listener object
<<<<<<< HEAD
func NewListener(addr string, port string, engine int, trackResponse bool, expire time.Duration, protocol TCPProtocol) (l *Listener) {
=======
func NewListener(addr string, port string, engine int, trackResponse bool, expire time.Duration, bpfFilter string) (l *Listener) {
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
func NewListener(addr string, port string, engine int, trackResponse bool, expire time.Duration, protocol TCPProtocol, bpfFilter string) (l *Listener) {
l = &Listener{}
l.packetsChan = make(chan *packet, 10000)
@@ -115,11 +110,8 @@ func NewListener(addr string, port string, engine int, trackResponse bool, expir
l.respAliases = make(map[uint32]*TCPMessage)
l.respWithoutReq = make(map[uint32]tcpID)
l.trackResponse = trackResponse
<<<<<<< HEAD
l.protocol = protocol
=======
l.bpfFilter = bpfFilter
>>>>>>> d309650589a56db2bfa93c533337e3db1cfb0425
l.addr = addr
_port, _ := strconv.Atoi(port)