{"id":13572826,"url":"https://github.com/slayercat/GoSNMPServer","last_synced_at":"2025-04-04T11:30:49.718Z","repository":{"id":36957326,"uuid":"236919592","full_name":"slayercat/GoSNMPServer","owner":"slayercat","description":"GoSNMPServer is an SNMP server library fully written in Go. It provides Server Get, GetNext, GetBulk, Walk, BulkWalk, Set and Traps. It supports IPv4 and IPv6, using SNMPv2c or SNMPv3.","archived":false,"fork":false,"pushed_at":"2024-11-08T01:25:57.000Z","size":88,"stargazers_count":105,"open_issues_count":11,"forks_count":57,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-04T04:06:03.144Z","etag":null,"topics":["golang","golang-library","server","snmp"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slayercat.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":"2020-01-29T06:36:33.000Z","updated_at":"2025-03-14T00:24:59.000Z","dependencies_parsed_at":"2023-01-17T08:15:17.196Z","dependency_job_id":"ddb947f2-d56c-4fe9-b844-ad4e6a5900a1","html_url":"https://github.com/slayercat/GoSNMPServer","commit_stats":{"total_commits":71,"total_committers":7,"mean_commits":"10.142857142857142","dds":0.09859154929577463,"last_synced_commit":"28e0ef7bd9c0f4ef18a132fbda31b0db70e25092"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slayercat%2FGoSNMPServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slayercat%2FGoSNMPServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slayercat%2FGoSNMPServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slayercat%2FGoSNMPServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slayercat","download_url":"https://codeload.github.com/slayercat/GoSNMPServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247117760,"owners_count":20886439,"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":["golang","golang-library","server","snmp"],"created_at":"2024-08-01T15:00:21.434Z","updated_at":"2025-04-04T11:30:44.710Z","avatar_url":"https://github.com/slayercat.png","language":"Go","funding_links":[],"categories":["Industrial protocols"],"sub_categories":["SNMP"],"readme":"GoSNMPServer\r\n======\r\n[![Build Status](https://travis-ci.org/slayercat/GoSNMPServer.svg?branch=master)](https://travis-ci.org/slayercat/GoSNMPServer)\r\n[![GoDoc](https://godoc.org/github.com/slayercat/GoSNMPServer?status.png)](https://godoc.org/github.com/slayercat/GoSNMPServer)\r\n[![codecov](https://codecov.io/gh/slayercat/GoSNMPServer/branch/master/graph/badge.svg)](https://codecov.io/gh/slayercat/GoSNMPServer)\r\n\r\nGoSNMPServer is an SNMP server library fully written in Go. It provides Server Get,\r\nGetNext, GetBulk, Walk, BulkWalk, Set and Traps. It supports IPv4 and\r\nIPv6, using __SNMPv2c__ or __SNMPv3__. Builds are tested against\r\nlinux/amd64 and linux/386.\r\n\r\nTL;DR\r\n-----\r\nBuild your own SNMP Server, try this:\r\n```shell\r\ngo install github.com/slayercat/GoSNMPServer/cmd/gosnmpserver\r\n$(go env GOPATH)/bin/gosnmpserver run-server\r\nsnmpwalk -v 3 -l authPriv  -n public -u testuser   -a md5 -A testauth -x des -X testpriv 127.0.0.1:1161 1\r\n```\r\n\r\nQuick Start\r\n-----\r\n```golang\r\nimport \"github.com/gosnmp/gosnmp\"\r\nimport \"github.com/slayercat/GoSNMPServer\"\r\nimport \"github.com/slayercat/GoSNMPServer/mibImps\"\r\n```\r\n\r\n```golang\r\n\r\nmaster := GoSNMPServer.MasterAgent{\r\n    Logger: GoSNMPServer.NewDefaultLogger(),\r\n    SecurityConfig: GoSNMPServer.SecurityConfig{\r\n        AuthoritativeEngineBoots: 1,\r\n        Users: []gosnmp.UsmSecurityParameters{\r\n            {\r\n                UserName:                 c.String(\"v3Username\"),\r\n                AuthenticationProtocol:   gosnmp.MD5,\r\n                PrivacyProtocol:          gosnmp.DES,\r\n                AuthenticationPassphrase: c.String(\"v3AuthenticationPassphrase\"),\r\n                PrivacyPassphrase:        c.String(\"v3PrivacyPassphrase\"),\r\n            },\r\n        },\r\n    },\r\n    SubAgents: []*GoSNMPServer.SubAgent{\r\n        {\r\n            CommunityIDs: []string{c.String(\"community\")},\r\n            OIDs:         mibImps.All(),\r\n        },\r\n    },\r\n}\r\nserver := GoSNMPServer.NewSNMPServer(master)\r\nerr := server.ListenUDP(\"udp\", \"127.0.0.1:1161\")\r\nif err != nil {\r\n    logger.Errorf(\"Error in listen: %+v\", err)\r\n}\r\nserver.ServeForever()\r\n```\r\n\r\n\r\nServe your own oids\r\n-----\r\nThis library provides some common oid for use. See [mibImps](https://github.com/slayercat/GoSNMPServer/tree/master/mibImps) for code, See [![GoDoc](https://godoc.org/github.com/slayercat/GoSNMPServe/mibImpsr?status.png)](https://godoc.org/github.com/slayercat/GoSNMPServer/mibImps) here.\r\n\r\n\r\nAppend `GoSNMPServer.PDUValueControlItem` to your SubAgent OIDS:\r\n```golang\r\n{\r\n    OID:      fmt.Sprintf(\"1.3.6.1.2.1.2.2.1.1.%d\", ifIndex),\r\n    Type:     gosnmp.Integer,\r\n    OnGet:    func() (value interface{}, err error) { return GoSNMPServer.Asn1IntegerWrap(ifIndex), nil },\r\n    Document: \"ifIndex\",\r\n},\r\n```\r\nSupports Types:  See RFC-2578 FOR SMI\r\n- Integer\r\n- OctetString\r\n- ObjectIdentifier\r\n- IPAddress\r\n- Counter32\r\n- Gauge32\r\n- TimeTicks\r\n- Counter64\r\n- Uinteger32\r\n- OpaqueFloat\r\n- OpaqueDouble\r\n\r\nCould use wrap function for detect type error. See `GoSNMPServer.Asn1IntegerWrap` / `GoSNMPServer.Asn1IntegerUnwrap` and so on.\r\n\r\nThanks\r\n-----\r\nThis library is based on **[soniah/gosnmp](https://github.com/soniah/gosnmp)** for encoder / decoders. \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslayercat%2FGoSNMPServer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslayercat%2FGoSNMPServer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslayercat%2FGoSNMPServer/lists"}