Documentation ¶
Overview ¶
Package joinserver provides a LoRaWAN-compliant Join Server implementation.
Index ¶
- func DeleteApplicationActivationSettings(ctx context.Context, r ApplicationActivationSettingRegistry, ...) error
- func DeleteDevice(ctx context.Context, r DeviceRegistry, appID ttnpb.ApplicationIdentifiers, ...) error
- func DeleteKeys(ctx context.Context, r KeyRegistry, joinEUI, devEUI types.EUI64, id []byte) error
- type ApplicationAccessAuthorizer
- type ApplicationActivationSettingRegistry
- type Authorizer
- type Config
- type DeviceRegistry
- type JoinServer
- func (js *JoinServer) Context() context.Context
- func (js *JoinServer) GetAppSKey(ctx context.Context, req *ttnpb.SessionKeyRequest, authorizer Authorizer) (*ttnpb.AppSKeyResponse, error)
- func (js *JoinServer) GetHomeNetID(ctx context.Context, joinEUI, devEUI types.EUI64, authorizer Authorizer) (*types.NetID, error)
- func (js *JoinServer) GetNwkSKeys(ctx context.Context, req *ttnpb.SessionKeyRequest, authorizer Authorizer) (*ttnpb.NwkSKeysResponse, error)
- func (js *JoinServer) HandleJoin(ctx context.Context, req *ttnpb.JoinRequest, authorizer Authorizer) (res *ttnpb.JoinResponse, err error)
- func (js *JoinServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)
- func (js *JoinServer) RegisterInterop(srv *interop.Server)
- func (js *JoinServer) RegisterServices(s *grpc.Server)
- func (js *JoinServer) Roles() []ttnpb.ClusterRole
- type KeyRegistry
- type TrustedOriginAuthorizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteApplicationActivationSettings ¶ added in v3.10.0
func DeleteApplicationActivationSettings(ctx context.Context, r ApplicationActivationSettingRegistry, appID ttnpb.ApplicationIdentifiers) error
DeleteApplicationActivationSettings deletes application activation settings from r.
func DeleteDevice ¶
func DeleteDevice(ctx context.Context, r DeviceRegistry, appID ttnpb.ApplicationIdentifiers, devID string) error
DeleteDevice deletes device identified by joinEUI, devEUI from r.
func DeleteKeys ¶
DeleteKeys deletes session keys identified by devEUI, id pair from r.
Types ¶
type ApplicationAccessAuthorizer ¶ added in v3.14.0
type ApplicationAccessAuthorizer interface { Authorizer RequireApplication(ctx context.Context, id ttnpb.ApplicationIdentifiers, required ...ttnpb.Right) error }
ApplicationAccessAuthorizer authorizes the request context for application access.
type ApplicationActivationSettingRegistry ¶ added in v3.10.0
type ApplicationActivationSettingRegistry interface { GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, paths []string) (*ttnpb.ApplicationActivationSettings, error) SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, paths []string, f func(*ttnpb.ApplicationActivationSettings) (*ttnpb.ApplicationActivationSettings, []string, error)) (*ttnpb.ApplicationActivationSettings, error) }
ApplicationActivationSettingRegistry is a registry, containing application activation settings.
type Authorizer ¶ added in v3.14.0
Authorizer checks whether the request context is authorized.
var ( // X509DNAuthorizer authorizes the caller by the X.509 Distinguished Name of the presented client certificate. X509DNAuthorizer Authorizer = new(x509DNAuthorizer) // ClusterAuthorizes authorizes clusters. ClusterAuthorizer Authorizer = new(clusterAuthorizer) // ApplicationRightsAuthorizes authorizes the caller by application rights. ApplicationRightsAuthorizer Authorizer = new(applicationRightsAuthorizer) )
type Config ¶
type Config struct { Devices DeviceRegistry `name:"-"` Keys KeyRegistry `name:"-"` ApplicationActivationSettings ApplicationActivationSettingRegistry `name:"-"` JoinEUIPrefixes []types.EUI64Prefix `name:"join-eui-prefix" description:"JoinEUI prefixes handled by this JS"` DeviceKEKLabel string `name:"device-kek-label" description:"Label of KEK used to encrypt device keys at rest"` }
Config represents the JoinServer configuration.
type DeviceRegistry ¶
type DeviceRegistry interface { GetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, paths []string) (*ttnpb.ContextualEndDevice, error) GetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string) (*ttnpb.EndDevice, error) SetByEUI(ctx context.Context, joinEUI types.EUI64, devEUI types.EUI64, paths []string, f func(context.Context, *ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.ContextualEndDevice, error) SetByID(ctx context.Context, appID ttnpb.ApplicationIdentifiers, devID string, paths []string, f func(*ttnpb.EndDevice) (*ttnpb.EndDevice, []string, error)) (*ttnpb.EndDevice, error) }
DeviceRegistry is a registry, containing devices.
type JoinServer ¶
JoinServer implements the Join Server component.
The Join Server exposes the NsJs, AsJs, AppJs and DeviceRegistry services.
func New ¶
func New(c *component.Component, conf *Config) (*JoinServer, error)
New returns new *JoinServer.
func (*JoinServer) Context ¶
func (js *JoinServer) Context() context.Context
Context returns the context of the Join Server.
func (*JoinServer) GetAppSKey ¶
func (js *JoinServer) GetAppSKey(ctx context.Context, req *ttnpb.SessionKeyRequest, authorizer Authorizer) (*ttnpb.AppSKeyResponse, error)
GetAppSKey returns the requested application session key.
func (*JoinServer) GetHomeNetID ¶
func (js *JoinServer) GetHomeNetID(ctx context.Context, joinEUI, devEUI types.EUI64, authorizer Authorizer) (*types.NetID, error)
GetHomeNetID returns the requested NetID.
func (*JoinServer) GetNwkSKeys ¶
func (js *JoinServer) GetNwkSKeys(ctx context.Context, req *ttnpb.SessionKeyRequest, authorizer Authorizer) (*ttnpb.NwkSKeysResponse, error)
GetNwkSKeys returns the requested network session keys.
func (*JoinServer) HandleJoin ¶
func (js *JoinServer) HandleJoin(ctx context.Context, req *ttnpb.JoinRequest, authorizer Authorizer) (res *ttnpb.JoinResponse, err error)
HandleJoin handles the given join-request.
func (*JoinServer) RegisterHandlers ¶
func (js *JoinServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)
RegisterHandlers registers gRPC handlers.
func (*JoinServer) RegisterInterop ¶
func (js *JoinServer) RegisterInterop(srv *interop.Server)
RegisterInterop registers the NS-JS and AS-JS interop services.
func (*JoinServer) RegisterServices ¶
func (js *JoinServer) RegisterServices(s *grpc.Server)
RegisterServices registers services provided by js at s.
func (*JoinServer) Roles ¶
func (js *JoinServer) Roles() []ttnpb.ClusterRole
Roles of the gRPC service.
type KeyRegistry ¶
type KeyRegistry interface { GetByID(ctx context.Context, joinEUI, devEUI types.EUI64, id []byte, paths []string) (*ttnpb.SessionKeys, error) SetByID(ctx context.Context, joinEUI, devEUI types.EUI64, id []byte, paths []string, f func(*ttnpb.SessionKeys) (*ttnpb.SessionKeys, []string, error)) (*ttnpb.SessionKeys, error) }
KeyRegistry is a registry, containing session keys.
type TrustedOriginAuthorizer ¶ added in v3.14.0
type TrustedOriginAuthorizer interface { Authorizer RequireAddress(ctx context.Context, addr string) error RequireID(ctx context.Context, id string) error }
TrustedOriginAuthorizer authorizes the request context by the trusted address or ID that the origin presents. This is typically used in TLS client authentication where the trusted address or ID are presented in the X.509 DN or SANs.