Documentation
¶
Index ¶
- Constants
- Variables
- func AwaitHealthy(ctx context.Context, svc blobcache.Service) error
- func DefaultActionsFile() (ret string)
- func DefaultGrantsFile() (ret string)
- func DefaultIdentitiesFile() (ret string)
- func DefaultObjectsFile() (ret string)
- func LoadPrivateKey(p string) (inet256.PrivateKey, error)
- func ParseActionsFile(data []byte) (ret []groupfile.Entry[GroupName, Action], _ error)
- func ParseIdentitiesFile(data []byte) (ret []groupfile.Entry[GroupName, Identity], _ error)
- func ParseObjectsFile(data []byte) (ret []groupfile.Entry[GroupName, ObjectSet], _ error)
- func ParsePeerLocs(data []byte) ([]groupfile.Entry[blobcache.PeerID, netip.AddrPort], error)
- func SavePrivateKey(p string, privKey inet256.PrivateKey) error
- func WriteActionsFile(w io.Writer, actions []groupfile.Entry[GroupName, Action]) error
- func WriteGrantsFile(w io.Writer, grants []Grant) error
- func WriteIdentitiesFile(w io.Writer, ents []groupfile.Entry[GroupName, Identity]) error
- func WriteObjectsFile(w io.Writer, ents []groupfile.Entry[GroupName, ObjectSet]) error
- type Action
- type Daemon
- func (d *Daemon) EnsureLocator() (*Locator, error)
- func (d *Daemon) EnsurePolicyFiles() error
- func (d *Daemon) EnsurePrivateKey() (inet256.PrivateKey, error)
- func (d *Daemon) GetPeerID() (blobcache.PeerID, error)
- func (d *Daemon) GetPolicy() (*Policy, error)
- func (d *Daemon) Run(ctx context.Context, pc net.PacketConn, serveAPI net.Listener) error
- type Entry
- type Grant
- type GroupName
- type Identity
- type Locator
- type Member
- type Membership
- type ObjectSet
- type Policy
- func (p *Policy) AllActionGroups() iter.Seq[string]
- func (p *Policy) AllGrants() iter.Seq[Grant]
- func (p *Policy) AllIdentityGroups() iter.Seq[string]
- func (p *Policy) AllObjectGroups() iter.Seq[string]
- func (p *Policy) CanConnect(peer blobcache.PeerID) bool
- func (p *Policy) CanCreate(peer blobcache.PeerID) bool
- func (p *Policy) IdentityMembersOf(group string) iter.Seq[Identity]
- func (p *Policy) IsIdentityDefined(iden Identity) bool
- func (p *Policy) OpenFiat(peer blobcache.PeerID, target blobcache.OID) blobcache.ActionSet
Constants ¶
const ( IdentitiesFilename = "IDENTITIES" ActionsFilename = "ACTIONS" ObjectsFilename = "OBJECTS" GrantsFilename = "GRANTS" )
Variables ¶
var Everyone = inet256.Everyone()
Functions ¶
func DefaultActionsFile ¶
func DefaultActionsFile() (ret string)
func DefaultGrantsFile ¶
func DefaultGrantsFile() (ret string)
func DefaultIdentitiesFile ¶
func DefaultIdentitiesFile() (ret string)
func DefaultObjectsFile ¶
func DefaultObjectsFile() (ret string)
func LoadPrivateKey ¶
func LoadPrivateKey(p string) (inet256.PrivateKey, error)
func ParseActionsFile ¶
func ParseIdentitiesFile ¶
ParseIdentitiesFiles parses a Group file into a list of identity group memberships.
func ParseObjectsFile ¶
func ParsePeerLocs ¶ added in v0.0.3
func SavePrivateKey ¶
func SavePrivateKey(p string, privKey inet256.PrivateKey) error
func WriteActionsFile ¶
func WriteIdentitiesFile ¶
WriteIdentitiesFile writes the memberships to the writer, such that they can be parsed by ParseIdentitiesFile. It inserts an extra newline every time the group changes from the previous membership.
Types ¶
type Action ¶
type Action string
const ( Action_LOAD Action = "LOAD" Action_SAVE Action = "SAVE" Action_POST Action = "POST" Action_GET Action = "GET" Action_EXISTS Action = "EXISTS" Action_DELETE Action = "DELETE" Action_COPY_FROM Action = "COPY_FROM" Action_COPY_TO Action = "COPY_TO" Action_LINK_FROM Action = "LINK_FROM" Action_LINK_TO Action = "LINK_TO" Action_UNLINK_FROM Action = "UNLINK_FROM" Action_CLONE Action = "CLONE" Action_CREATE Action = "CREATE" )
func AllActions ¶
func AllActions() []Action
func ParseAction ¶
type Daemon ¶
type Daemon struct {
StateDir string
}
Daemon manages the state and configuration for running a Blobache node.
func BGTestDaemon ¶ added in v0.0.2
BGTestDaemon launches a test daemon and returns it and the API address. This function will block until the daemon is healthy. The daemon will be stopped and cleaned up at the end of the test. The test will fail during cleanup if the daemon fails to stop, and The test will not complete until the daemon is successfully torn down.
func (*Daemon) EnsureLocator ¶ added in v0.0.3
func (*Daemon) EnsurePolicyFiles ¶
EnsurePolicyFiles ensures that the policy files exist. Creating default files if they don't exist.
func (*Daemon) EnsurePrivateKey ¶
func (d *Daemon) EnsurePrivateKey() (inet256.PrivateKey, error)
EnsurePrivateKey generates a private key if it doesn't exist, and returns it.
type Entry ¶ added in v0.0.3
func LoadActionsFile ¶
LoadActionsFile loads the actions file from the filesystem. p should be the path to the actions file.
func LoadIdentitiesFile ¶
LoadIdentitiesFile loads the identities file from the filesystem. p should be the path to the identities file.
type Grant ¶
type Grant struct {
Subject groupfile.Member[GroupName, Identity]
Action groupfile.Member[GroupName, Action]
Object groupfile.Member[GroupName, ObjectSet]
}
func LoadGrantsFile ¶
LoadGrantsFile loads the grants file from the filesystem. p should be the path to the grants file.
type Identity ¶
func ParseIdentity ¶
type Locator ¶ added in v0.0.3
type Locator struct {
// contains filtered or unexported fields
}
func LoadLocator ¶ added in v0.0.3
LoadLocator creates a new locator using the PEER_LOC file at p
type Membership ¶
type Membership[T any] = groupfile.Membership[GroupName, T]
type ObjectSet ¶
type ObjectSet struct {
// ByOID is a specific OID
ByOID *blobcache.OID
// All refers to all possible objects
All *struct{}
}
ObjectSet is something that Actions are performed on. It can be a specific OID, or a set of names defined by a regular expression.
func ParseObject ¶
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
func LoadPolicy ¶
LoadPolicy loads the 4 policy files from the filesystem. stateDir should be the path to the state directory.
func (*Policy) IdentityMembersOf ¶
func (*Policy) IsIdentityDefined ¶
IsDefined returns true if the identity is a defined group, or a peer.