Skip to content

vkhamsao/gozebra

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gozebra

About

A quagga zapi library implemented in Go.

Usage

cli, _ := zebra.NewClient("unix", "/var/run/quagga/zserv.api", zebra.ROUTE_BGP)

go func() {
	for {
		m := <-cli.Receive()
		log.Debug(m)
	}
}()

// this asks zebra to send all interface information
cli.SendCommand(zebra.INTERFACE_ADD, nil)

b := &zebra.IPRouteBody{
	Type:         zebra.ROUTE_BGP,
	SAFI:         zebra.SAFI_UNICAST,
	Message:      zebra.MESSAGE_NEXTHOP | zebra.MESSAGE_DISTANCE | zebra.MESSAGE_METRIC,
	Prefix:       net.ParseIP("10.10.10.0".To4()),
	PrefixLength: 24,
	Nexthops:     []net.IP{net.ParseIP("192.168.2.2").To4()},
	Distance:     10,
	Metric:       20,
}

cli.SendCommand(zebra.IPV4_ROUTE_ADD, b)

cli.Close()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%