https://github.com/bmhatfield/sunset
Retrieve crepscular timings from sunrise-sunset.org
https://github.com/bmhatfield/sunset
go golang sunrise sunrise-sunset sunset
Last synced: 7 months ago
JSON representation
Retrieve crepscular timings from sunrise-sunset.org
- Host: GitHub
- URL: https://github.com/bmhatfield/sunset
- Owner: bmhatfield
- License: mit
- Created: 2017-11-24T17:33:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-04T15:53:01.000Z (over 7 years ago)
- Last Synced: 2025-01-23T21:29:35.106Z (9 months ago)
- Topics: go, golang, sunrise, sunrise-sunset, sunset
- Language: Go
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sunset
Retrieve crepscular timings from sunrise-sunset.org
[]( https://godoc.org/github.com/bmhatfield/sunset/sunset)
## Design
This package is designed to be able to automatically retrieve Sunset timings based upon your current GeoIP. Each type and method is separately exported, so you can insert your own logic anywhere in the chain. For an example of how the chain ties together, see `sunset/sunset.go`
For an explanation of the different times returned, please see [MrReid.org's explanations](http://wordpress.mrreid.org/2013/02/05/dawn-dusk-sunrise-sunset-and-twilight/)
## APIs
`freegeoip.go`: GeoIP infromation from [freegeoip.net](https://freegeoip.net/). Works around IPv6 limitations.
`ipify.go`: Your current IPv4 from [ipify.org](https://api.ipify.org?format=json). Used to work around FreeGeoIP's IPv6 issues.
`sunrise-sunset.go`: Sunrise timings from [sunrise-sunset.org](https://api.sunrise-sunset.org/json?lat=36.7201600&lng=-4.4203400&formatted=0). Times are in UTC and must be converted with `.Local()`.
## Use
Go Get: `go get -u github.com/bmhatfield/sunset`
CLI: `go run print-sunset.go`
API: `sunset.Time()`