// https://www.snmpsharpnet.com/?p=153 oid := []uint32{ uint32(oidBytes[0]) / 40, uint32(oidBytes[0]) % 40, } for i := 1; i < len(oidBytes); { bbyte := oidBytes[i] // Short form if bbyte & 0x80 == 0 { oid = append(oid, uint32(bbyte)) i++ continue } done := false tmp := uint32(0) for !done { tmp <<= 7 bbyte = oidBytes[i] done = bbyte & 0x80 == 0 bbyte &= 0x7F tmp += uint32(bbyte) i++ } oid = append(oid, uint32(tmp)) }