diff options
-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{ |