From fccd5bb66f985db0a0d150342ca0a9529a23488a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 13 Jun 2015 13:35:15 -0700 Subject: [PATCH] misc: add GitHub Pages IP addresses GitHub occasionally changes the IP addresses from which GitHub Pages websites are served. For users of the service, they must upgrade any A records to these IP addresses to continue using the service. This patch provides this data in the `APIMeta` struct as the property `Pages` and populates from the /meta endpoint. Release Announcement: https://developer.github.com/changes/2015-06-11-pages-a-records/ Fixes #212. --- github/misc.go | 4 ++++ github/misc_test.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/github/misc.go b/github/misc.go index d501405..66e7f52 100644 --- a/github/misc.go +++ b/github/misc.go @@ -98,6 +98,10 @@ type APIMeta struct { // username and password, sudo mode, and two-factor authentication are // not supported on these servers.) VerifiablePasswordAuthentication *bool `json:"verifiable_password_authentication,omitempty"` + + // An array of IP addresses in CIDR format specifying the addresses + // which serve GitHub Pages websites. + Pages []string `json:"pages,omitempty"` } // APIMeta returns information about GitHub.com, the service. Or, if you access diff --git a/github/misc_test.go b/github/misc_test.go index 438f28f..8ca58d2 100644 --- a/github/misc_test.go +++ b/github/misc_test.go @@ -72,7 +72,7 @@ func TestAPIMeta(t *testing.T) { mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{"hooks":["h"], "git":["g"], "verifiable_password_authentication": true}`) + fmt.Fprint(w, `{"hooks":["h"], "git":["g"], "pages":["p"], "verifiable_password_authentication": true}`) }) meta, _, err := client.APIMeta() @@ -83,6 +83,7 @@ func TestAPIMeta(t *testing.T) { want := &APIMeta{ Hooks: []string{"h"}, Git: []string{"g"}, + Pages: []string{"p"}, VerifiablePasswordAuthentication: Bool(true), } if !reflect.DeepEqual(want, meta) {