{"id":37225591,"url":"https://github.com/andaru/netconf","last_synced_at":"2026-01-15T01:48:06.241Z","repository":{"id":82196400,"uuid":"125158181","full_name":"andaru/netconf","owner":"andaru","description":"Idiomatic NETCONF libraries for Go","archived":false,"fork":false,"pushed_at":"2023-03-25T12:02:46.000Z","size":99,"stargazers_count":19,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T06:31:40.950Z","etag":null,"topics":["codec","netconf","netconf-libraries","yang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andaru.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-14T05:09:02.000Z","updated_at":"2024-05-10T08:21:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"ba4b5852-a3f1-49fd-ae23-3bf7e19df6bb","html_url":"https://github.com/andaru/netconf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/andaru/netconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andaru%2Fnetconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andaru%2Fnetconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andaru%2Fnetconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andaru%2Fnetconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andaru","download_url":"https://codeload.github.com/andaru/netconf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andaru%2Fnetconf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"ssl_error","status_checked_at":"2026-01-15T00:55:20.945Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["codec","netconf","netconf-libraries","yang"],"created_at":"2026-01-15T01:48:05.759Z","updated_at":"2026-01-15T01:48:06.228Z","avatar_url":"https://github.com/andaru.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NETCONF support libraries for golang #\n\nSupport libraries for writing [NETCONF](https://tools.ietf.org/html/rfc6241) applications in\n[Go](https://golang.org/).\n\n## Install ##\n\nAdd to your go module, running the tests to be sure.\n\n```bash\n# add netconf package to your go module\n$ go get github.com/andaru/netconf\n# run the tests\n$ (go test github.com/andaru/netconf/... \u0026\u0026 echo \"OK: tests passed\") || echo \"FAIL: uhoh, tests failed\"\n```\n\n## Introduction ##\n\nWith these libraries, it's easy to build NETCONF applications.\n\nBy taking care of the messy and inconvenient parts of NETCONF transport and message handling, these libraries let you write fully-featured NETCONF clients and servers with support for any underlying network transport.\n\n## Quickstart ##\n\n### Client ###\n\n* Instantiate a new `session.Session` using an `io.Reader` and `io.WriteCloser` from your transport\n (client or server), typically via SSH or TLS.\n\n```go\nimport (\n  \"io\"\n  \"log\"\n\n  \"github.com/andaru/netconf/session\"\n)\n\ntype ClientHandler struct {\n  // any local client state goes here\n}\n\nfunc (h *ClientHandler) OnEstablished(s *session.Session) {\n  // called once by the session runner, after session start-up, framing mode and capabilities exchange\n  for _, capabilityString := range s.State.Capabilties {\n    // inspect the remote peer's capabilities against your own (s.Config.Capabilities)\n  }\n  // use the established trigger an RPC request immediately (alternatively, start an RPC request sender\n  // goroutine to run alongside the client handler, using the OnClose handler method to shut it down)\n  _, err := s.Outgoing().Write([]byte(`\u003crpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"\u003e...\u003c/rpc\u003e`))\n}\n\n// OnMessage is called for each message received by the session from the peer\nfunc (h *ClientHandler) OnMessage(s *session.Session) {\n  // Consider use of the github.com/antchfx/xmlquery package instead of io.ReadAll to\n  // parse NETCONF response XML data from the server (\u003crpc-reply\u003e elements).\n\n  // read the entire message (all chunks, when in chunked mode)\n  _, err := io.ReadAll(s.Incoming())\n  // typical read error handling\n  if err != nil {\n    if err != session.ErrEndOfStream {\n      s.AddError(err)\n      // abnormal session termination occurred (likely a transport error)\n    }\n    // move the status to error state, which will terminate the session and call OnError()\n    s.State.Status = session.StatusError\n    return\n  }\n  // otherwise, handle server response, then...\n  // send another request (default server capabilities require \u003crpc\u003e to be sent one at a time)...\n}\n\n// OnError is called when the session status changes to session.StatusError\nfunc (h *ClientHandler) OnError(s *session.Session) { /* look at s.Errors() */ }\n\n// OnClose is called when the session status changes to session.StatusClosed\nfunc (h *ClientHandler) OnClose(s *session.Session) {}\n\nfunc main() {\n  // setup transport io.Reader as r, io.WriteCloser as w\n  clientHandler := \u0026ClientHandler{}\n  // Create a NETCONF session with base and chunked capabilities\n  s := session.New(r, w, session.Config{\n    Capabilities: {\n      \"urn:ietf:params:netconf:base:1.0\", // required by all clients\n      \"urn:ietf:params:netconf:base:1.1\" // your client will support chunked encoding\n    },\n  })\n  // Run our client handler on the session\n  s.Run(clientHandler)\n}\n```\n\n## Key Features ##\n\n* NETCONF stream decoders and encoders with full NETCONF 1.1 support\n* Support for both NETCONF `:base:1.0` (aka _end of message delimited_) and `:base:1.1` (aka _chunked_) framing.\n* A NETCONF `session.Session` type with corresponding `session.Handler` interface.\n  * Performs session initialization (`\u003chello\u003e` and `\u003ccapabilities\u003e` exchange) and session validation\n    common to both client and server sessions, as well as any required framing mode switch.\n  * Allows NETCONF application development based on `session.Handler` event handlers along with access\n    to the session's current `Incoming` and `Outgoing` messages (as handler callback arguments).\n  * Supports both client and server session customization.\n  * Use `*xml.Decoder` or any other consumer supporting an `io.Reader` source to consume NETCONF messages.\n  * Use `*xml.Encoder` or any other producer supporting an `io.WriteCloser` destination to produce NETCONF messages.\n\n### Related libraries under development ###\n\n* A streaming gRPC protocol for passing transport data\n  * Allows e.g., `openssh` calling a small binary using the protocol client to call into a central NETCONF management agent running the protocol server\n* A document object model (perhaps an extension of `xmlquery`)\n* Encoding, decoding and validation of YANG data, including:\n  * [RFC6020 XML](https://tools.ietf.org/html/rfc6020) and [RFC7951 JSON](https://tools.ietf.org/html/rfc7951) encoding and   decoding of YANG data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandaru%2Fnetconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandaru%2Fnetconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandaru%2Fnetconf/lists"}