// Copyright 2016 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.// +build darwin dragonfly freebsd netbsd openbsdpackage route// A Message represents a routing message.typeMessageinterface {// Sys returns operating system-specific information.Sys() []Sys}// A Sys reprensents operating system-specific information.typeSysinterface {// SysType returns a type of operating system-specific // information.SysType() SysType}// A SysType represents a type of operating system-specific// information.typeSysTypeintconst (SysMetricsSysType = iotaSysStats)// ParseRIB parses b as a routing information base and returns a list// of routing messages.func ( RIBType, []byte) ([]Message, error) {if !.parseable() {returnnil, errUnsupportedMessage }var []Message , := 0, 0forlen() > 4 { ++ := int(nativeEndian.Uint16([:2]))if == 0 {returnnil, errInvalidMessage }iflen() < {returnnil, errMessageTooShort }if [2] != rtmVersion { = [:]continue }if , := wireFormats[int([3])]; ! { ++ } else { , := .parse(, )if != nil {returnnil, }if == nil { ++ } else { = append(, ) } } = [:] }// We failed to parse any of the messages - version mismatch?if != len()+ {returnnil, errMessageMismatch }return , nil}
The pages are generated with Goldsv0.3.6. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.