main.go 542 B

1234567891011121314151617181920212223242526272829303132
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "os"
  6. "github.com/zu1k/proxypool/config"
  7. "github.com/zu1k/proxypool/api"
  8. "github.com/zu1k/proxypool/app"
  9. )
  10. func main() {
  11. filePath := flag.String("c", "source.yaml", "path to config file: source.yaml")
  12. flag.Parse()
  13. c, err := config.Parse(*filePath)
  14. if err != nil {
  15. fmt.Println("Error: ", err.Error())
  16. os.Exit(1)
  17. }
  18. if c == nil {
  19. fmt.Println("Error: no sources")
  20. os.Exit(2)
  21. }
  22. app.InitGetters(c.Sources)
  23. go app.Cron()
  24. fmt.Println("Do the first crawl...")
  25. app.CrawlGo()
  26. api.Run()
  27. }