bfd

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2024 License: GPL-2.0 Imports: 9 Imported by: 0

README

BFD

Experimental Bidirectional Forwarding Detection implementation in Go. Incomplete and probably very wrong.

Partially implements:

This package will negotiate a BFD session with any directly connected peer that attempts to connect.

Only one session per peer is supported currently.

Example usage

func main() {
    ip := netip.MustParseAddr(os.Args[1])

    bfd := bfd.BFD{}
    err := bfd.Start()

    if err != nil {
	log.Fatal("Start: ", err)
    }

    for {
        fmt.Println(ip, bfd.Query(ip))
        time.Sleep(time.Second)
    }
}

If you were running this on 10.1.2.3 as go run main.go 10.1.2.4, and on host 10.1.2.4 you set BIRD up with:

protocol bfd {
    neighbor 10.1.2.3;
}

then you should see a BFD session come up:

root:~/bfd/cmd# go run main.go 10.1.2.4
10.1.2.4 false
10.1.2.4 true
10.1.2.4 true
10.1.2.4 true
...

Documentation

Index

Constants

View Source
const (
	AdminDown state = 0
	Down      state = 1
	Init      state = 2
	Up        state = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BFD

type BFD struct {
	// contains filtered or unexported fields
}

func (*BFD) IsUp added in v0.0.4

func (b *BFD) IsUp(addr netip.Addr) bool

func (*BFD) Start

func (b *BFD) Start() error

type ControlPacket added in v0.0.4

type ControlPacket []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL