Skip to content

Commit

Permalink
Add bunny.net
Browse files Browse the repository at this point in the history
  • Loading branch information
fileformat committed Nov 8, 2024
1 parent 31c8b1f commit b2ea55c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Server that determines your physical location by looking at headers sent from va

Try it with:
[AWS CloudFront](https://aws-geo.redirect2.me/)
| [Bunny.net](https://bunny-geo.redirect2.me/)
| [Cloudflare](https://cf-geo.redirect2.me/)
| [Fastly](https://cdn-geo.global.ssl.fastly.net/)
| [Google AppEngine](https://ae-geo.redirect2.me/)
Expand Down Expand Up @@ -35,6 +36,12 @@ Good luck!
</details>

<details>
<details>
<summary>Bunny.net</summary>

Very easy to setup: Add a [pull zone](https://dash.bunny.net/cdn/add) pointing to your server. Bunny.net fills in headers for state and country.

</details>
<summary>Cloudflare</summary>

[Website](https://www.cloudflare.com/) |
Expand Down Expand Up @@ -88,6 +95,7 @@ Send a `callback` parameter to get JSONP instead of JSON.
## Credits

[![AWS](https://www.vectorlogo.zone/logos/amazon_aws/amazon_aws-ar21.svg)](https://aws.amazon.com/ "CDN and Geolocation")
[![Bunny.net](https://www.vectorlogo.zone/logos/bunnynet/bunnynet-ar21.svg)](https://www.bunny.net/ "CDN and Geolocation")
[![Cloudflare](https://www.vectorlogo.zone/logos/cloudflare/cloudflare-ar21.svg)](https://www.cloudflare.com/ "CDN and Geolocation")
[![Fastly](https://www.vectorlogo.zone/logos/fastly/fastly-ar21.svg)](https://www.fastly.com/ "CDN")
[![Git](https://www.vectorlogo.zone/logos/git-scm/git-scm-ar21.svg)](https://git-scm.com/ "Version control")
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
export LASTMOD=$(date -u)
export COMMIT=local

go run server.go appengine.go aws.go cloudflare.go fastly.go faviconIco.go headers.go jsonp.go status.go util.go --port=4000 --verbose --awshost=localhost:4000
go run server.go appengine.go aws.go bunny.go cloudflare.go fastly.go faviconIco.go headers.go jsonp.go status.go util.go --port=4000 --verbose --awshost=localhost:4000
4 changes: 4 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
aeHostname = flag.String("aehost", "ae-geo.redirect2.me", "hostname for AppEngine")
cfHostname = flag.String("cfhost", "cf-geo.redirect2.me", "hostname for Cloudflare")
awsHostname = flag.String("awshost", "origin-aws-geo.redirect2.me", "origin hostname for AWS CloudFront (not the actual hostname)")
bunnyHostname = flag.String("bunnyhost", "origin-bunny-geo.redirect2.me", "origin hostname for Bunny.net (not the actual hostname)")
fastlyHostname = flag.String("fastlyhost", "cdn-geo.global.ssl.fastly.net", "hostname for Fastly")

logger = log.New(os.Stdout, "R2ME-GEO: ", log.Ldate|log.Ltime|log.Lmicroseconds|log.LUTC)
Expand Down Expand Up @@ -69,6 +70,8 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
fastlyRootHandler(w, r)
} else if host == *awsHostname {
awsRootHandler(w, r)
} else if host == *bunnyHostname {
bunnyRootHandler(w, r)
} else {
logger.Printf("WARN: unknown host '%s'\n", host)
http.Redirect(w, r, "https://github.com/redirect2me/cdn-geolocation", http.StatusTemporaryRedirect)
Expand Down Expand Up @@ -101,6 +104,7 @@ func main() {
http.HandleFunc("/headers.html", headersHandler)

http.HandleFunc("/api/appengine.json", appengineApiHandler)
http.HandleFunc("/api/bunny.json", bunnyApiHandler)
http.HandleFunc("/api/cloudflare.json", cloudflareApiHandler)
http.HandleFunc("/api/fastly.json", fastlyApiHandler)
http.HandleFunc("/api/aws.json", awsApiHandler)
Expand Down

0 comments on commit b2ea55c

Please sign in to comment.