32 lines
550 B
Go
Executable File
32 lines
550 B
Go
Executable File
package main
|
|
|
|
import (
|
|
"errors"
|
|
"flag"
|
|
"net/http"
|
|
_ "net/http/pprof"
|
|
)
|
|
|
|
func main() {
|
|
if err := by_command(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func by_command() error {
|
|
cmd := flag.String("cmd", "", "cmd as encode, decode, ts, batch, torname, fromrname, part...")
|
|
pprof := flag.Bool("pprof", false, "enable pprof on :6060")
|
|
flag.Parse()
|
|
if *pprof {
|
|
go func() { http.ListenAndServe(":6060", nil) }()
|
|
}
|
|
err := errors.New("unknown command " + *cmd)
|
|
switch *cmd {
|
|
case "encode":
|
|
err = Enc()
|
|
case "decode":
|
|
err = Dec()
|
|
}
|
|
return err
|
|
}
|