policy

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2022 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy struct {
	// contains filtered or unexported fields
}

func New

func New(cfg config.Policy) (*Policy, error)

func (*Policy) Allow added in v0.2.0

func (p *Policy) Allow(peerID peer.ID) bool

Allow alters the policy to allow the specified peer. Returns true if the policy needed to be updated.

func (*Policy) Allowed

func (p *Policy) Allowed(peerID peer.ID) bool

Allowed returns true if the policy allows the peer to index content. This check does not check whether the peer is trusted. An allowed peer must still be verified.

func (*Policy) Block added in v0.2.0

func (p *Policy) Block(peerID peer.ID) bool

Block alters the policy to not allow the specified peer. Returns true if the policy needed to be updated.

func (*Policy) Check added in v0.2.0

func (p *Policy) Check(peerID peer.ID) (bool, bool)

Check returns whether the two bool values. The fisrt is true if the peer is allowed. The second is true if the peer is allowed and is trusted (does not require verification).

func (*Policy) Config added in v0.2.0

func (p *Policy) Config(cfg config.Policy) error

Config applies the configuration.

func (*Policy) ToConfig added in v0.2.0

func (p *Policy) ToConfig() config.Policy

ToConfig converts a Policy into a config.Policy.

func (*Policy) Trusted

func (p *Policy) Trusted(peerID peer.ID) bool

Trusted returns true if the peer is explicitly trusted. A trusted peer is allowed to register without requiring verification.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL