diff options
| author | James Mills <prologic@shortcircuit.net.au> | 2018-04-03 14:32:43 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-03 14:32:43 -0700 | 
| commit | fe18a79dd2f7115b30d440a025a7f7f72486dd09 (patch) | |
| tree | a2a5c9f24f90837013c6407077f687bf47de4934 /cmd | |
| parent | Removed build artifacts accidently committed to dist/ (diff) | |
| download | gopherproxy-fe18a79dd2f7115b30d440a025a7f7f72486dd09.tar.gz gopherproxy-fe18a79dd2f7115b30d440a025a7f7f72486dd09.tar.bz2 gopherproxy-fe18a79dd2f7115b30d440a025a7f7f72486dd09.zip | |
Add support for robots.txt user agent control from web crawlers (#10)
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/gopherproxy/main.go | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/cmd/gopherproxy/main.go b/cmd/gopherproxy/main.go index 9a7d1f9..84bde30 100644 --- a/cmd/gopherproxy/main.go +++ b/cmd/gopherproxy/main.go | |||
| @@ -8,12 +8,16 @@ import ( | |||
| 8 | ) | 8 | ) | 
| 9 | 9 | ||
| 10 | var ( | 10 | var ( | 
| 11 | bind = flag.String("bind", "0.0.0.0:8000", "[int]:port to bind to") | 11 | // TODO: Allow config file and environment vars | 
| 12 | uri = flag.String("uri", "floodgap.com", "<host>:[port] to proxy to") | 12 | // (opt -> env -> config -> default) | 
| 13 | bind = flag.String("bind", "0.0.0.0:8000", "[int]:port to bind to") | ||
| 14 | robotsfile = flag.String("robots-file", "robots.txt", "robots.txt file") | ||
| 15 | uri = flag.String("uri", "floodgap.com", "<host>:[port] to proxy to") | ||
| 13 | ) | 16 | ) | 
| 14 | 17 | ||
| 15 | func main() { | 18 | func main() { | 
| 16 | flag.Parse() | 19 | flag.Parse() | 
| 17 | 20 | ||
| 18 | log.Fatal(gopherproxy.ListenAndServe(*bind, *uri)) | 21 | // Use a config struct | 
| 22 | log.Fatal(gopherproxy.ListenAndServe(*bind, *robotsfile, *uri)) | ||
| 19 | } | 23 | } | 
