2021-12-29 17:08:30 +00:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
2022-01-08 15:48:19 +00:00
|
|
|
"flag"
|
2021-12-29 17:08:30 +00:00
|
|
|
)
|
|
|
|
|
2022-01-08 15:48:19 +00:00
|
|
|
func ParseArgs() (string, string, bool) {
|
|
|
|
port := flag.String("port", "8080", "port")
|
|
|
|
dns := flag.String("dns", "8.8.8.8", "DNS server")
|
|
|
|
debug := flag.Bool("debug", false, "true | false")
|
|
|
|
|
|
|
|
flag.Parse()
|
2022-01-03 07:24:39 +00:00
|
|
|
|
2022-01-08 15:48:19 +00:00
|
|
|
return *port, *dns, *debug
|
2022-01-03 07:24:39 +00:00
|
|
|
}
|
2022-01-03 15:13:42 +00:00
|
|
|
|
2022-01-07 13:44:03 +00:00
|
|
|
func BytesToChunks(buf []byte) [][]byte {
|
|
|
|
if len(buf) < 1 {
|
|
|
|
return [][]byte{buf}
|
|
|
|
}
|
2022-01-03 15:13:42 +00:00
|
|
|
|
2022-01-07 13:44:03 +00:00
|
|
|
return [][]byte{buf[:1], buf[1:]}
|
2022-01-03 15:13:42 +00:00
|
|
|
}
|