{"id":19810161,"url":"https://github.com/dnslink-std/go","last_synced_at":"2025-05-01T08:31:40.617Z","repository":{"id":57614963,"uuid":"380757056","full_name":"dnslink-std/go","owner":"dnslink-std","description":"The reference implementation for DNSLink in golang. ","archived":false,"fork":false,"pushed_at":"2022-07-06T08:21:13.000Z","size":148,"stargazers_count":11,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T03:45:49.234Z","etag":null,"topics":["decentralized-web","dnslink","dweb","golang","p2p"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnslink-std.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-27T14:12:42.000Z","updated_at":"2024-06-20T03:45:49.235Z","dependencies_parsed_at":"2022-09-11T03:00:45.674Z","dependency_job_id":null,"html_url":"https://github.com/dnslink-std/go","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Fgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Fgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Fgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnslink-std%2Fgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnslink-std","download_url":"https://codeload.github.com/dnslink-std/go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224246450,"owners_count":17279794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decentralized-web","dnslink","dweb","golang","p2p"],"created_at":"2024-11-12T09:19:40.556Z","updated_at":"2024-11-12T09:19:41.029Z","avatar_url":"https://github.com/dnslink-std.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dnslink-std/go\n\nThe reference implementation for DNSLink in golang.\n\n## Usage\n\nYou can use dnslink both as code and as an CLI tool.\n\n## Golang API\n\nGetting started with the dnslink in a jiffy:\n\n```go\nimport {\n\tdnslink \"github.com/dnslink-std/go\"\n}\n\nresult, error := dnslink.Resolve(\"dnslink.dev\")\n\nif error != nil {\n  switch e := error.(type) {\n  default:\n    // A variety other errors may be returned. Possible causes include, but are not limited to:\n    // - Invalid input\n    // - Timeouts / aborts\n    // - Networking errors\n    // - Incompatible dns packets provided by server\n    panic(e)\n  case dnslink.DNSRCodeError:\n    err.DNSRCode // Error code number following - https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6\n    err.Name // Error code name following (same list)\n    err.Code // \"RCODE_%s\", err.RCode\n    err.Domain // Domain lookup that resulted in the error\n    if e.RCode == 3 {\n      // NXDomain = Domain not found; most relevant error\n    }\n  }\n}\n\n// `links` property is a map[string][]string containing given links for the different keys, sorted.\nresult.Links[\"ipfs\"][0] == \"QmTg....yomU\"\n\n// The `log` is always an Array and contains a list of log entries\n// that were should help to trace back how the linked data was resolved.\nresult.Log\n\n// The `txtEntries` are a reduced form of the links that contains the namespace\n// as part of the value.\nresult.TxtEntries === [{ value: \"/ipfs/QmTg....yomU\", ttl: 60 }]\n```\n\nYou can configure the DNS resolution\n\n```go\nimport {\n  \"net\"\n  \"context\"\n  \"time\"\n}\n\nresolver := \u0026dnslink.Resolver{\n  LookupTXT: dnslink.NewUDPLookup(\"1.1.1.1:53\"),\n}\n\n// The resolver will now use googles 1.1.1.1 dns server.\nresolver.Resolve(\"dnslink.dev\")\n```\n\n## Possible log statements\n\nThe `dnslink.LogStatements` in the `log` all follow the [DNSLink specification][log-codes].\n\n[log-codes]: https://github.com/dnslink-std/test/blob/main/LOG_CODES.md\n\n## Command Line\n\nTo get the [command line tool](./dnslink) you can either install it using `go get`\n\n```sh\ngo get -u github.com/dnslink-std/go/dnslink\n```\n\nOr download a binary asset from the github [release page](https://github.com/dnslink-std/go/releases/latest).\n\nYou can get detailed help for the app by passing a `--help` option at the end:\n\n```sh\ndnslink --help\n```\n\n## License\n\nPublished under dual-license: [MIT OR Apache-2.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnslink-std%2Fgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnslink-std%2Fgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnslink-std%2Fgo/lists"}