mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
goreplay-cli package (#1148)
change package from `main -> goreplay` this will allow importing `goreplay` as a package
This commit is contained in:
@@ -31,19 +31,19 @@ vendor:
|
||||
go mod vendor
|
||||
|
||||
release-bin-linux-amd64: vendor
|
||||
docker run --platform linux/amd64 --rm -v `pwd`:$(SOURCE_PATH) -t --env GOOS=linux --env GOARCH=amd64 -i $(CONTAINER_AMD) go build -mod=vendor -o $(BIN_NAME) -tags netgo $(LDFLAGS)
|
||||
docker run --platform linux/amd64 --rm -v `pwd`:$(SOURCE_PATH) -t --env GOOS=linux --env GOARCH=amd64 -i $(CONTAINER_AMD) go build -mod=vendor -o $(BIN_NAME) -tags netgo $(LDFLAGS) ./cmd/gor/
|
||||
|
||||
release-bin-linux-arm64: vendor
|
||||
docker run --platform linux/arm64 --rm -v `pwd`:$(SOURCE_PATH) -t --env GOOS=linux --env GOARCH=arm64 -i $(CONTAINER_ARM) go build -mod=vendor -o $(BIN_NAME) -tags netgo $(LDFLAGS)
|
||||
docker run --platform linux/arm64 --rm -v `pwd`:$(SOURCE_PATH) -t --env GOOS=linux --env GOARCH=arm64 -i $(CONTAINER_ARM) go build -mod=vendor -o $(BIN_NAME) -tags netgo $(LDFLAGS) ./cmd/gor/
|
||||
|
||||
release-bin-mac-amd64: vendor
|
||||
GOOS=darwin go build -mod=vendor -o $(BIN_NAME) $(MAC_LDFLAGS)
|
||||
GOOS=darwin go build -mod=vendor -o $(BIN_NAME) $(MAC_LDFLAGS) ./cmd/gor/
|
||||
|
||||
release-bin-mac-arm64: vendor
|
||||
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -mod=vendor -o $(BIN_NAME) $(MAC_LDFLAGS)
|
||||
|
||||
release-bin-windows: vendor
|
||||
docker run -it --rm -v `pwd`:$(SOURCE_PATH) -w $(SOURCE_PATH) -e CGO_ENABLED=1 docker.elastic.co/beats-dev/golang-crossbuild:1.19.2-main --build-cmd "make VERSION=$(VERSION) build" -p "windows/amd64"
|
||||
docker run -it --rm -v `pwd`:$(SOURCE_PATH) -w $(SOURCE_PATH) -e CGO_ENABLED=1 docker.elastic.co/beats-dev/golang-crossbuild:1.19.2-main --build-cmd "make VERSION=$(VERSION) build" -p "windows/amd64" ./cmd/gor/
|
||||
mv $(BIN_NAME) "$(BIN_NAME).exe"
|
||||
|
||||
release-linux-amd64: dist release-bin-linux-amd64
|
||||
|
||||
+14
-13
@@ -6,6 +6,7 @@ import (
|
||||
"expvar"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
@@ -71,23 +72,23 @@ func main() {
|
||||
}
|
||||
|
||||
args := os.Args[1:]
|
||||
var plugins *InOutPlugins
|
||||
var plugins *goreplay.InOutPlugins
|
||||
if len(args) > 0 && args[0] == "file-server" {
|
||||
if len(args) != 2 {
|
||||
log.Fatal("You should specify port and IP (optional) for the file server. Example: `gor file-server :80`")
|
||||
}
|
||||
dir, _ := os.Getwd()
|
||||
|
||||
Debug(0, "Started example file server for current directory on address ", args[1])
|
||||
goreplay.Debug(0, "Started example file server for current directory on address ", args[1])
|
||||
|
||||
log.Fatal(http.ListenAndServe(args[1], loggingMiddleware(args[1], http.FileServer(http.Dir(dir)))))
|
||||
} else {
|
||||
flag.Parse()
|
||||
checkSettings()
|
||||
plugins = NewPlugins()
|
||||
goreplay.CheckSettings()
|
||||
plugins = goreplay.NewPlugins()
|
||||
}
|
||||
|
||||
log.Printf("[PPID %d and PID %d] Version:%s\n", os.Getppid(), os.Getpid(), VERSION)
|
||||
log.Printf("[PPID %d and PID %d] Version:%s\n", os.Getppid(), os.Getpid(), goreplay.VERSION)
|
||||
|
||||
if len(plugins.Inputs) == 0 || len(plugins.Outputs) == 0 {
|
||||
log.Fatal("Required at least 1 input and 1 output")
|
||||
@@ -101,20 +102,20 @@ func main() {
|
||||
profileCPU(*cpuprofile)
|
||||
}
|
||||
|
||||
if Settings.Pprof != "" {
|
||||
if goreplay.Settings.Pprof != "" {
|
||||
go func() {
|
||||
log.Println(http.ListenAndServe(Settings.Pprof, nil))
|
||||
log.Println(http.ListenAndServe(goreplay.Settings.Pprof, nil))
|
||||
}()
|
||||
}
|
||||
|
||||
closeCh := make(chan int)
|
||||
emitter := NewEmitter()
|
||||
go emitter.Start(plugins, Settings.Middleware)
|
||||
if Settings.ExitAfter > 0 {
|
||||
log.Printf("Running gor for a duration of %s\n", Settings.ExitAfter)
|
||||
emitter := goreplay.NewEmitter()
|
||||
go emitter.Start(plugins, goreplay.Settings.Middleware)
|
||||
if goreplay.Settings.ExitAfter > 0 {
|
||||
log.Printf("Running gor for a duration of %s\n", goreplay.Settings.ExitAfter)
|
||||
|
||||
time.AfterFunc(Settings.ExitAfter, func() {
|
||||
log.Printf("gor run timeout %s\n", Settings.ExitAfter)
|
||||
time.AfterFunc(goreplay.Settings.ExitAfter, func() {
|
||||
log.Printf("gor run timeout %s\n", goreplay.Settings.ExitAfter)
|
||||
close(closeCh)
|
||||
})
|
||||
}
|
||||
+2
-3
@@ -1,14 +1,13 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"log"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
|
||||
elastigo "github.com/mattbaird/elastigo/lib"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/internal/byteutils"
|
||||
"hash/fnv"
|
||||
"io"
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/buger/goreplay/byteutils"
|
||||
"github.com/coocood/freecache"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -24,9 +24,8 @@ import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
"os"
|
||||
)
|
||||
|
||||
// requestID -> originalToken
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
+2
-3
@@ -1,12 +1,11 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"hash/fnv"
|
||||
"strings"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
)
|
||||
|
||||
type HTTPModifier struct {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -24,9 +24,7 @@ type HTTPModifierConfig struct {
|
||||
Methods HTTPMethods `json:"http-allow-method"`
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-allow-header, --http-disallow-header options
|
||||
//
|
||||
type headerFilter struct {
|
||||
name []byte
|
||||
regexp *regexp.Regexp
|
||||
@@ -56,9 +54,7 @@ func (h *HTTPHeaderFilters) Set(value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-basic-auth-filter option
|
||||
//
|
||||
type basicAuthFilter struct {
|
||||
regexp *regexp.Regexp
|
||||
}
|
||||
@@ -82,9 +78,7 @@ func (h *HTTPHeaderBasicAuthFilters) Set(value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-allow-header-hash and --http-allow-param-hash options
|
||||
//
|
||||
type hashFilter struct {
|
||||
name []byte
|
||||
percent uint32
|
||||
@@ -129,9 +123,7 @@ func (h *HTTPHashFilters) Set(value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-set-header option
|
||||
//
|
||||
type httpHeader struct {
|
||||
Name string
|
||||
Value string
|
||||
@@ -160,9 +152,7 @@ func (h *HTTPHeaders) Set(value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-set-param option
|
||||
//
|
||||
type httpParam struct {
|
||||
Name []byte
|
||||
Value []byte
|
||||
@@ -208,9 +198,7 @@ func (h *HTTPMethods) Set(value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-rewrite-url option
|
||||
//
|
||||
type urlRewrite struct {
|
||||
src *regexp.Regexp
|
||||
target []byte
|
||||
@@ -237,9 +225,7 @@ func (r *URLRewriteMap) Set(value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-rewrite-header option
|
||||
//
|
||||
type headerRewrite struct {
|
||||
header []byte
|
||||
src *regexp.Regexp
|
||||
@@ -275,9 +261,7 @@ func (r *HeaderRewriteMap) Set(value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// Handling of --http-allow-url option
|
||||
//
|
||||
type urlRegexp struct {
|
||||
regexp *regexp.Regexp
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHTTPModifierWithoutConfig(t *testing.T) {
|
||||
|
||||
+2
-3
@@ -1,14 +1,13 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"io/ioutil"
|
||||
"net/http/httputil"
|
||||
"strconv"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
)
|
||||
|
||||
func prettifyHTTP(p []byte) []byte {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
)
|
||||
|
||||
func TestHTTPPrettifierGzip(t *testing.T) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
+4
-5
@@ -1,17 +1,16 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/internal/capture"
|
||||
"github.com/buger/goreplay/internal/tcp"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"log"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/buger/goreplay/capture"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"github.com/buger/goreplay/tcp"
|
||||
)
|
||||
|
||||
// RAWInputConfig represents configuration that can be applied on raw input
|
||||
|
||||
+4
-5
@@ -1,7 +1,10 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/buger/goreplay/internal/capture"
|
||||
"github.com/buger/goreplay/internal/tcp"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -13,10 +16,6 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/capture"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"github.com/buger/goreplay/tcp"
|
||||
)
|
||||
|
||||
const testRawExpire = time.Millisecond * 200
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
@@ -5,6 +5,9 @@ import (
|
||||
"errors"
|
||||
"expvar"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/internal/size"
|
||||
"github.com/buger/goreplay/internal/tcp"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
@@ -15,10 +18,6 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
"github.com/buger/goreplay/size"
|
||||
"github.com/buger/goreplay/tcp"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
"github.com/google/gopacket/pcap"
|
||||
@@ -286,6 +285,7 @@ func (l *Listener) ListenBackground(ctx context.Context) chan error {
|
||||
}
|
||||
|
||||
// Allowed format:
|
||||
//
|
||||
// [namespace/]pod/[pod_name]
|
||||
// [namespace/]deployment/[deployment_name]
|
||||
// [namespace/]daemonset/[daemonset_name]
|
||||
@@ -9,11 +9,14 @@ example:
|
||||
|
||||
// for the transport should be "tcp"
|
||||
listener, err := capture.NewListener(host, port, transport, engine, trackResponse)
|
||||
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
listener.SetPcapOptions(opts)
|
||||
err = listner.Activate()
|
||||
|
||||
if err != nil {
|
||||
// handle it
|
||||
}
|
||||
@@ -21,15 +24,19 @@ if err != nil {
|
||||
if err := listener.Listen(context.Background(), handler); err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
// or
|
||||
errCh := listener.ListenBackground(context.Background(), handler) // runs in the background
|
||||
select {
|
||||
case err := <- errCh:
|
||||
|
||||
// handle error
|
||||
|
||||
case <-quit:
|
||||
|
||||
//
|
||||
|
||||
case <- l.Reading: // if we have started reading
|
||||
}
|
||||
|
||||
*/
|
||||
package capture // import github.com/buger/goreplay/capture
|
||||
@@ -4,7 +4,6 @@ parsing, reassembling tcp packets, handling communication with engine listeners(
|
||||
and reporting errors and statistics of packets.
|
||||
the packets are parsed by following TCP way(https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure).
|
||||
|
||||
|
||||
example:
|
||||
|
||||
import "github.com/buger/goreplay/tcp"
|
||||
@@ -22,6 +21,5 @@ you can use pool.End or/and pool.Start to set custom session behaviors
|
||||
|
||||
debugLevel in debugger function indicates the priority of the logs, the bigger the number the lower
|
||||
the priority. errors are signified by debug level 4 for errors, 5 for discarded packets, and 6 for received packets.
|
||||
|
||||
*/
|
||||
package tcp // import github.com/buger/goreplay/tcp
|
||||
@@ -4,13 +4,12 @@ import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"net"
|
||||
"reflect"
|
||||
"sort"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
)
|
||||
|
||||
// TCPProtocol is a number to indicate type of protocol
|
||||
@@ -3,6 +3,7 @@ package tcp
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"github.com/buger/goreplay/proto"
|
||||
|
||||
// "runtime"
|
||||
"testing"
|
||||
@@ -10,7 +11,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/buger/goreplay/proto"
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"github.com/xdg-go/scram"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//go:build !race
|
||||
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"github.com/buger/goreplay/internal/size"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/size"
|
||||
)
|
||||
|
||||
// BinaryOutputConfig struct for holding binary output configuration
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
+2
-3
@@ -1,10 +1,11 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"compress/gzip"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/internal/size"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
@@ -16,8 +17,6 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/size"
|
||||
)
|
||||
|
||||
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
|
||||
+2
-3
@@ -1,7 +1,8 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/internal/size"
|
||||
"math/rand"
|
||||
"os"
|
||||
"reflect"
|
||||
@@ -10,8 +11,6 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/size"
|
||||
)
|
||||
|
||||
func TestFileOutput(t *testing.T) {
|
||||
|
||||
+2
-3
@@ -1,10 +1,11 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/internal/size"
|
||||
"log"
|
||||
"math"
|
||||
"net/http"
|
||||
@@ -12,8 +13,6 @@ import (
|
||||
"net/url"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/size"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/buger/goreplay/internal/byteutils"
|
||||
"github.com/buger/goreplay/proto"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/byteutils"
|
||||
"github.com/buger/goreplay/proto"
|
||||
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/Shopify/sarama/mocks"
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
// NullOutput used for debugging, prints nothing
|
||||
type NullOutput struct {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
_ "bufio"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"github.com/gorilla/websocket"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
// PRO this value indicates if goreplay is running in PRO mode..
|
||||
// it must not be modified explicitly in production
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// +build gofuzz
|
||||
//go:build gofuzz
|
||||
|
||||
package proto
|
||||
|
||||
|
||||
+1
-2
@@ -19,13 +19,12 @@ package proto
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"github.com/buger/goreplay/internal/byteutils"
|
||||
|
||||
_ "fmt"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"strings"
|
||||
|
||||
"github.com/buger/goreplay/byteutils"
|
||||
)
|
||||
|
||||
// CRLF In HTTP newline defined by 2 bytes (for both windows and *nix support)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//go:build pro
|
||||
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/buger/goreplay/internal/size"
|
||||
"os"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/buger/goreplay/size"
|
||||
)
|
||||
|
||||
// DEMO indicates that goreplay is running in demo mode
|
||||
@@ -276,7 +275,7 @@ func init() {
|
||||
|
||||
}
|
||||
|
||||
func checkSettings() {
|
||||
func CheckSettings() {
|
||||
if Settings.OutputFileConfig.SizeLimit < 1 {
|
||||
Settings.OutputFileConfig.SizeLimit.Set("32mb")
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
type writeCallback func(*Message)
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package goreplay
|
||||
|
||||
// VERSION the current version of goreplay
|
||||
var VERSION = "1.3.0"
|
||||
|
||||
Reference in New Issue
Block a user