summaryrefslogtreecommitdiffhomepage
path: root/docs/sources/lib.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/sources/lib.md')
-rw-r--r--docs/sources/lib.md12
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{