go-aptproxy/main.go

30 lines
551 B
Go
Raw Normal View History

package main
import (
2016-04-27 00:15:31 +02:00
"flag"
"log"
"os"
"os/signal"
"syscall"
)
func main() {
2016-04-27 00:15:31 +02:00
var (
addr = flag.String("addr", ":8000", "`host:port` to listen on")
directory = flag.String("directory", "/var/lib/go-aptproxy", "`directory` used for storing packages")
)
flag.Parse()
s, err := NewServer(*addr, *directory)
if err != nil {
2016-04-27 00:15:31 +02:00
log.Println(err)
os.Exit(1)
}
s.Start()
2016-04-27 00:15:31 +02:00
defer s.Stop()
log.Println("APT proxy started")
c := make(chan os.Signal)
signal.Notify(c, syscall.SIGINT)
<-c
2016-04-27 00:15:31 +02:00
log.Println("APT proxy shut down by signal")
}