mirror of
https://github.com/zr-hebo/sniffer-agent.git
synced 2025-08-11 17:11:06 +08:00
Initial commit
This commit is contained in:
31
communicator/config.go
Normal file
31
communicator/config.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package communicator
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
_ "net/http/pprof"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
var (
|
||||
communicatePort int
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.IntVar(&communicatePort, "communicate_port", 8088, "http server port. Default is 8088")
|
||||
}
|
||||
|
||||
func Server() {
|
||||
server := &http.Server{
|
||||
Addr: ":" + string(communicatePort),
|
||||
Handler: mux.NewRouter(),
|
||||
IdleTimeout: time.Second * 5,
|
||||
}
|
||||
|
||||
if err := server.ListenAndServe(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user