Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/ns1-goPublic

Golang API client for NS1

License

NotificationsYou must be signed in to change notification settings

ns1/ns1-go

Repository files navigation

Build StatusGoDoc

NS1 Golang SDK

This project is inactive development.

The golang client for the NS1 API:https://ns1.com/api/

The documentation can be found here:https://pkg.go.dev/gopkg.in/ns1/ns1-go.v2

Installing

$ go get gopkg.in/ns1/ns1-go.v2

Examples

See more

package mainimport ("fmt""log""net/http""os""time"api"gopkg.in/ns1/ns1-go.v2/rest")funcmain() {k:=os.Getenv("NS1_APIKEY")ifk=="" {fmt.Println("NS1_APIKEY environment variable is not set, giving up")os.Exit(1)}httpClient:=&http.Client{Timeout:time.Second*10}client:=api.NewClient(httpClient,api.SetAPIKey(k))zones,_,err:=client.Zones.List()iferr!=nil {log.Fatal(err)}for_,z:=rangezones {fmt.Println(z.Zone)}}

DNS views and compatibility with pre-2.6.6 SDK versions

DNS views allow NS1 to serve one set of data to one group of clients(e.g. internal employees), and different results to other groups ofclients (e.g. public internet). Multiple zones can now have the samefully-qualified domain name (FQDN), with propagation controlled via ACLsand the Views feature. For more information, please refer to thisNS1 documentation page.

Users who do not need views can ignore this feature. Users who douse views must now use the user-suppliedname field in the APIto uniquely identify a zone. More than one zone can have the sameFQDN, but theirname fields must be unique.

For compatibility, thezone field is unchanged in existing functions.Whenname and FQDN differ, and you are calling a func that takeszone,you must add thename identifier as well. The zone's FQDN is onlyrequired during zone or record creation.

When using views, the NewNamedZone and NewNamedRecord funcs are providedto create zones and records. If not using views, you can continue usingthe older functions.

Contributing

Pull Requests and issues are welcome. See theNS1 Contribution Guidelines for more information.

Run tests:

make test

Local dev: use thego.modreplace directive orgo work usein client code to point to the local checkout of this repository.

Consider running./script/install-git-hooks to install local git hooks for thisproject.

LICENSE

Apache2 - see the included LICENSE file for more information


[8]ページ先頭

©2009-2025 Movatter.jp