diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-09 07:28:33 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-09 08:55:11 +0900 |
commit | 809f941df96effc326362f63bbdbd05d3335f689 (patch) | |
tree | 5f8713297d67bb4bd462086d5a03658787be5074 /docs | |
parent | 345b848330b30e002455715146491ffc5291b025 (diff) |
docs/lib.md: add PeerMonitor API
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/sources/lib.md | 12 |
1 files changed, 12 insertions, 0 deletions
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{ |