From 809f941df96effc326362f63bbdbd05d3335f689 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 9 Nov 2018 07:28:33 +0900 Subject: docs/lib.md: add PeerMonitor API Signed-off-by: FUJITA Tomonori --- docs/sources/lib.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/sources/lib.md b/docs/sources/lib.md index f0fbfc35..fb8ba5ee 100644 --- a/docs/sources/lib.md +++ b/docs/sources/lib.md @@ -43,6 +43,18 @@ func main() { log.Fatal(err) } + // monitor the change of the peer state + if pm, err := s.NewPeerMonitor(&api.MonitorPeerRequest{}); err != nil { + log.Fatal(err) + } else { + defer pm.Close() + go func() { + for v := range pm.Inbox { + log.Info(v) + } + }() + } + // neighbor configuration n := &api.Peer{ Conf: &api.PeerConf{ -- cgit v1.2.3