|
|
|
@ -31,11 +31,12 @@ func (c loggingClient) Get( |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
var ( |
|
|
|
|
storePath = flag.String("store-path", "", "Path to sqlite storage file. If not given then a temporary in-memory storage is used") |
|
|
|
|
maxAge = flag.Duration("max-age", 0, "Maximum duration since last check of a resource, before it must be checked again. Must be used with -store-path") |
|
|
|
|
urls = flag.String("urls", "", `Comma-separated list of URLs which are always checked. At least one is required`) |
|
|
|
|
patternsStr = flag.String("patterns", "", "Comma-separated list of regexps. All URLs which match one of these will have their links checked as well") |
|
|
|
|
concurrency = flag.Int("concurrency", runtime.NumCPU()/2, "Number simultaneous requests to make at a time") |
|
|
|
|
storePath = flag.String("store-path", "", "Path to sqlite storage file. If not given then a temporary in-memory storage is used") |
|
|
|
|
maxAge = flag.Duration("max-age", 0, "Maximum duration since last check of a resource, before it must be checked again. Must be used with -store-path") |
|
|
|
|
urls = flag.String("urls", "", `Comma-separated list of URLs which are always checked. At least one is required`) |
|
|
|
|
patternsStr = flag.String("patterns", "", "Comma-separated list of regexps. All URLs which match one of these will have their links checked as well") |
|
|
|
|
concurrency = flag.Int("concurrency", runtime.NumCPU()/2, "Number simultaneous requests to make at a time") |
|
|
|
|
httpUserAgent = flag.String("http-user-agent", "", "User-agent to use for http requests") |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
flag.Parse() |
|
|
|
@ -64,7 +65,9 @@ func main() { |
|
|
|
|
patterns, |
|
|
|
|
&deadlinks.Opts{ |
|
|
|
|
NewClient: func() deadlinks.Client { |
|
|
|
|
return loggingClient{deadlinks.NewClient(nil)} |
|
|
|
|
return loggingClient{deadlinks.NewClient(&deadlinks.ClientOpts{ |
|
|
|
|
HTTPUserAgent: *httpUserAgent, |
|
|
|
|
})} |
|
|
|
|
}, |
|
|
|
|
Concurrency: *concurrency, |
|
|
|
|
OnError: func(err error) { |
|
|
|
|