Rename --output-dummy to --output-stdout and make it boolean (#282)

This commit is contained in:
Leonid Bugaev
2016-05-21 21:16:47 +06:00
parent d944ac6789
commit bf13dc59c3
4 changed files with 13 additions and 6 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ Download latest binary from https://github.com/buger/gor/releases or (compile by
## Getting started
The most basic setup will be `sudo ./gor --input-raw :8000 --output-dummy=""` which acts like tcpdump.
The most basic setup will be `sudo ./gor --input-raw :8000 --output-stdout` which acts like tcpdump.
If you already have test environment you can start replaying: `sudo ./gor --input-raw :8000 --output-http http://staging.env`.
See the our wiki and especially [Getting started](https://github.com/buger/gor/wiki/Getting-Started) wiki page for more info.
+2 -2
View File
@@ -9,14 +9,14 @@ type DummyOutput struct {
}
// NewDummyOutput constructor for DummyOutput
func NewDummyOutput(options string) (di *DummyOutput) {
func NewDummyOutput() (di *DummyOutput) {
di = new(DummyOutput)
return
}
func (i *DummyOutput) Write(data []byte) (int, error) {
fmt.Println("Writing message: ", string(data))
fmt.Println(string(data))
return len(data), nil
}
+6 -2
View File
@@ -84,8 +84,12 @@ func InitPlugins() {
registerPlugin(NewDummyInput, options)
}
for _, options := range Settings.outputDummy {
registerPlugin(NewDummyOutput, options)
for range Settings.outputDummy {
registerPlugin(NewDummyOutput)
}
if Settings.outputStdout {
registerPlugin(NewDummyOutput)
}
engine := EnginePcap
+4 -1
View File
@@ -33,6 +33,7 @@ type AppSettings struct {
inputDummy MultiOption
outputDummy MultiOption
outputStdout bool
inputTCP MultiOption
outputTCP MultiOption
@@ -73,7 +74,9 @@ func init() {
flag.BoolVar(&Settings.splitOutput, "split-output", false, "By default each output gets same traffic. If set to `true` it splits traffic equally among all outputs.")
flag.Var(&Settings.inputDummy, "input-dummy", "Used for testing outputs. Emits 'Get /' request every 1s")
flag.Var(&Settings.outputDummy, "output-dummy", "Used for testing inputs. Just prints data coming from inputs.")
flag.Var(&Settings.outputDummy, "output-dummy", "DEPRECATED: use --output-stdout instead")
flag.BoolVar(&Settings.outputStdout, "output-stdout", false, "Used for testing inputs. Just prints to console data coming from inputs.")
flag.Var(&Settings.inputTCP, "input-tcp", "Used for internal communication between Gor instances. Example: \n\t# Receive requests from other Gor instances on 28020 port, and redirect output to staging\n\tgor --input-tcp :28020 --output-http staging.com")
flag.Var(&Settings.outputTCP, "output-tcp", "Used for internal communication between Gor instances. Example: \n\t# Listen for requests on 80 port and forward them to other Gor instance on 28020 port\n\tgor --input-raw :80 --output-tcp replay.local:28020")