mirror of
https://github.com/byReqz/probehost2.git
synced 2024-11-21 14:23:15 +00:00
add short flags
This commit is contained in:
parent
ccb2a41305
commit
273b42399b
5
go.mod
5
go.mod
@ -4,4 +4,7 @@ go 1.17
|
||||
|
||||
require github.com/sirupsen/logrus v1.8.1
|
||||
|
||||
require golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
|
||||
require (
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -4,6 +4,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
||||
|
9
main.go
9
main.go
@ -6,9 +6,10 @@ import (
|
||||
"strings"
|
||||
"net/http"
|
||||
"net"
|
||||
"flag"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
flag "github.com/spf13/pflag"
|
||||
|
||||
)
|
||||
|
||||
var logstdout = log.New()
|
||||
@ -19,9 +20,9 @@ var usexforwardedfor bool
|
||||
|
||||
func init() {
|
||||
var logfilepath string
|
||||
flag.StringVar(&logfilepath, "logfilepath", "probehost2.log", "sets the output file for the log")
|
||||
flag.IntVar(&listenport, "port", 8000, "sets the port to listen on")
|
||||
flag.BoolVar(&usexforwardedfor, "use-x-forwarded-for", true, "specifies whether to show x-forwarded-for or the requesting IP")
|
||||
flag.StringVarP(&logfilepath, "logfilepath", "o","probehost2.log", "sets the output file for the log")
|
||||
flag.IntVarP(&listenport, "port", "p", 8000, "sets the port to listen on")
|
||||
flag.BoolVarP(&usexforwardedfor, "use-x-forwarded-for", "x", true, "specifies whether to show x-forwarded-for or the requesting IP")
|
||||
flag.Parse()
|
||||
|
||||
logstdout.SetFormatter(&log.TextFormatter{
|
||||
|
Loading…
Reference in New Issue
Block a user