waku-org/go-waku

View on GitHub
waku/v2/onlinechecker/online.go

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package onlinechecker

// OnlineChecker is used to determine if node has connectivity.
type OnlineChecker interface {
    IsOnline() bool
}

type DefaultOnlineChecker struct {
    online bool
}

func NewDefaultOnlineChecker(online bool) OnlineChecker {
    return &DefaultOnlineChecker{
        online: online,
    }
}

func (o *DefaultOnlineChecker) SetOnline(online bool) {
    o.online = online
}

func (o *DefaultOnlineChecker) IsOnline() bool {
    return o.online
}