apistruct

package
v0.0.0-...-d40a6bc Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermRead  auth.Permission = "read" // default
	PermWrite auth.Permission = "write"
	PermSign  auth.Permission = "sign"  // Use wallet keys for signing
	PermAdmin auth.Permission = "admin" // Manage permissions
)

Variables

View Source
var DefaultPerms = []auth.Permission{PermRead}

Functions

func PermissionedFullAPI

func PermissionedFullAPI(a api.FullNode) api.FullNode

Types

type CommonStruct

type CommonStruct struct {
	Internal struct {
		AuthVerify func(ctx context.Context, token string) ([]auth.Permission, error) `perm:"read"`
		AuthNew    func(ctx context.Context, perms []auth.Permission) ([]byte, error) `perm:"admin"`

		SysUptime func(context.Context) (string, error)      `perm:"read"`
		Version   func(context.Context) (api.Version, error) `perm:"read"`

		LogList     func(context.Context) ([]string, error)     `perm:"write"`
		LogSetLevel func(context.Context, string, string) error `perm:"write"`

		Shutdown func(context.Context) error                    `perm:"admin"`
		Closing  func(context.Context) (<-chan struct{}, error) `perm:"read"`
	}
}

func (*CommonStruct) AuthNew

func (c *CommonStruct) AuthNew(ctx context.Context, perms []auth.Permission) ([]byte, error)

func (*CommonStruct) AuthVerify

func (c *CommonStruct) AuthVerify(ctx context.Context, token string) ([]auth.Permission, error)

func (*CommonStruct) Closing

func (c *CommonStruct) Closing(ctx context.Context) (<-chan struct{}, error)

func (*CommonStruct) LogList

func (c *CommonStruct) LogList(ctx context.Context) ([]string, error)

func (*CommonStruct) LogSetLevel

func (c *CommonStruct) LogSetLevel(ctx context.Context, group, level string) error

func (*CommonStruct) Shutdown

func (c *CommonStruct) Shutdown(ctx context.Context) error

func (*CommonStruct) SysUptime

func (c *CommonStruct) SysUptime(ctx context.Context) (string, error)

func (*CommonStruct) Version

func (c *CommonStruct) Version(ctx context.Context) (api.Version, error)

Version implements API.Version

type FullNodeStruct

type FullNodeStruct struct {
	CommonStruct

	Internal struct {
		//star function
		WorkersList func(context.Context) (string, error) `perm:"read"`
		MinerInfo   func(context.Context) (string, error) `perm:"read"`
	}
}

FullNodeStruct implements API passing calls to user-provided function values.

func (FullNodeStruct) ID

func (f FullNodeStruct) ID(ctx context.Context) (peer.ID, error)

func (*FullNodeStruct) MinerInfo

func (c *FullNodeStruct) MinerInfo(ctx context.Context) (string, error)

func (*FullNodeStruct) WorkersList

func (c *FullNodeStruct) WorkersList(ctx context.Context) (string, error)

FullNodeStruct

Jump to

Keyboard shortcuts

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