公司需要做全网拓扑图,交换机默认就开启的lldp
服务器有一个lldpd的软件也可以实现,
下面是go版简单的lldp
package main
import (
"net"
"github.com/mdlayher/raw"
"github.com/mdlayher/lldp"
"log"
"fmt"
"time"
"bytes"
"github.com/mdlayher/ethernet"
"strings"
)
func main() {
ifaces, err := net.Interfaces()
if err!= nil {
log.Fatalln(err)
}
// 本机的唯一标示
sysName := "PDH"
for _, ifi := ran