cluster

package
v0.0.0-...-60b8695 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cluster contains cluster authentication-related utilities.

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// AuthType used to identify components.
	AuthType = "ClusterKey"
)

Functions

func Authorized

func Authorized(ctx context.Context) error

Authorized returns whether the context has been identified as a cluster call. It panics if it does not inherit from `NewContext`.

Example
package main

import (
	"context"

	"github.com/aureliar8/ttn-fork/pkg/auth/cluster"
)

func main() {
	var ( // Assume this comes from a hypothetical inter-cluster RPC call.
		ctx context.Context
	)

	if err := cluster.Authorized(ctx); err != nil {
		// return err
	}
}
Output:

func NewContext

func NewContext(ctx context.Context, err error) context.Context

NewContext returns a context containing the cluster authentication result.

func VerifySource

func VerifySource(ctx context.Context, validKeys [][]byte) context.Context

VerifySource inspects whether the context contains one of the passed cluster keys, and returns a context containing the result.

Types

This section is empty.

Jump to

Keyboard shortcuts

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