policy

package
v0.0.0-...-403c8b4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 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

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.

func (*Policy) Block

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) Copy

func (p *Policy) Copy(other *Policy)

Copy copies another policy.

func (*Policy) NoneAllowed

func (p *Policy) NoneAllowed() bool

Return true if no peers are allowed.

func (*Policy) PublishAllowed

func (p *Policy) PublishAllowed(publisherID, providerID peer.ID) bool

PublishAllowed returns true if policy allows the publisher to publish advertisements for the identified provider. This assumes that both are already allowed by policy.

func (*Policy) ToConfig

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

ToConfig converts a Policy into a config.Policy.

Jump to

Keyboard shortcuts

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