// RunCLI is the main entrypoint for the procrastiproxy package
RunCLI is the main entrypoint for the procrastiproxy package
// RunCLI is the main entrypoint for the procrastiproxy package
func RunCLI() error {
	flag.Usage = outputHelp
	port := flag.String("port", "8000", "Port to listen on. Defaults to 8000")
	logLevel := flag.String("loglevel", "info", "Log level. Defaults to Info")
	blockList := flag.String("block", "", "Host to block. Defaults to none")
	blockStartTime := flag.String("block-start-time", defaultBlockStartTime, "Start of business hours. Defaults to 9:00AM")
	blockEndTime := flag.String("block-end-time", defaultBlockEndTime, "End of business hours. Defaults to 5:00PM")
	flag.Parse()
	level, err := log.ParseLevel(*logLevel)
	if err != nil {
		level = log.DebugLevel
	}
	log.SetLevel(level)
	parseBlockListInput(blockList)
	p := NewProcrastiproxy()
	p.ConfigureProxyTimeSettings(*blockStartTime, *blockEndTime)
	if *port == "" {
		return errors.New("You must supply a valid port via the --port flag")
	}
	if *blockList == "" {
		log.Info("Proxy will allow all traffic, because you did not supply any sites to block via the --block flag")
	}
	args := []string{*port, *blockList}
	RunServer(args)
	return nil
}
func RunCLI ( ) error { flag . Usage = outputHelp port := flag . String ( " " , " " , " " ) logLevel := flag . String ( " " , " " , " " ) blockList := flag . String ( " " , " " , " " ) blockStartTime := flag . String ( " " , defaultBlockStartTime , " " ) blockEndTime := flag . String ( " " , defaultBlockEndTime , " " ) flag . Parse ( ) level , err := log . ParseLevel ( * logLevel ) if err != nil { level = log . DebugLevel } log . SetLevel ( level ) parseBlockListInput ( blockList ) p := NewProcrastiproxy ( ) p . ConfigureProxyTimeSettings ( * blockStartTime , * blockEndTime ) if * port == " " { return errors . New ( " " ) } if * blockList == " " { log . Info ( " " ) } args := [ ] string { * port , * blockList } RunServer ( args ) return nil }
RunCLI is the main entrypoint for the procrastiproxy package
RunCLI is the main entrypoint for the procrastiproxy package
// Configure proxy time-based block settings