threadnetwork

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package threadnetwork provides a fluent Go API over the macOS ThreadNetwork framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type THClient

type THClient struct {
	// contains filtered or unexported fields
}

A class that supports safely sharing Thread credentials between multiple clients.

THClient wraps raw.THClient with a fluent Go API.

func NewTHClient

func NewTHClient() *THClient

NewTHClient creates a new THClient.

func THClientFromID

func THClientFromID(id objc.ID) *THClient

THClientFromID adopts an existing object pointer as a THClient (nil for 0).

func (*THClient) CheckPreferredNetworkForActiveOperationalDatasetCompletion

func (x *THClient) CheckPreferredNetworkForActiveOperationalDatasetCompletion(activeOperationalDataSet *foundation.NSData, completion func(bool))

Determines if the essential operating parameters match the preferred network’s parameters.

CheckPreferredNetworkForActiveOperationalDatasetCompletion calls the underlying CheckPreferredNetworkForActiveOperationalDatasetCompletion.

func (*THClient) DeleteCredentialsForBorderAgentCompletion

func (x *THClient) DeleteCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) error

Deletes Thread network credentials from the framework database for a Border Agent.

DeleteCredentialsForBorderAgentCompletion blocks until the operation completes or ctx is cancelled.

func (*THClient) ID

func (x *THClient) ID() objc.ID

ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.

func (*THClient) IsPreferredNetworkAvailableWithCompletion

func (x *THClient) IsPreferredNetworkAvailableWithCompletion(completion func(bool))

Indicates whether a preferred network is available.

IsPreferredNetworkAvailableWithCompletion calls the underlying IsPreferredNetworkAvailableWithCompletion.

func (*THClient) RetrieveAllActiveCredentials

func (x *THClient) RetrieveAllActiveCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)

Returns a set of the active credentials.

RetrieveAllActiveCredentials blocks until the operation completes or ctx is cancelled.

func (*THClient) RetrieveAllCredentials

func (x *THClient) RetrieveAllCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)

Requests all Thread credentials from the framework.

RetrieveAllCredentials blocks until the operation completes or ctx is cancelled.

func (*THClient) RetrieveCredentialsForBorderAgentCompletion

func (x *THClient) RetrieveCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) (*THCredentials, error)

Requests Thread credentials for a Border Agent.

RetrieveCredentialsForBorderAgentCompletion blocks until the operation completes or ctx is cancelled.

func (*THClient) RetrieveCredentialsForExtendedPANIDCompletion

func (x *THClient) RetrieveCredentialsForExtendedPANIDCompletion(ctx context.Context, extendedPANID *foundation.NSData) (*THCredentials, error)

Requests Thread credentials for an extended Personal Area Network (PAN) ID.

RetrieveCredentialsForExtendedPANIDCompletion blocks until the operation completes or ctx is cancelled.

func (*THClient) RetrievePreferredCredentials

func (x *THClient) RetrievePreferredCredentials(ctx context.Context) (*THCredentials, error)

Requests Thread credentials for the preferred network.

RetrievePreferredCredentials blocks until the operation completes or ctx is cancelled.

func (*THClient) StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion

func (x *THClient) StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion(ctx context.Context, borderAgentID *foundation.NSData, activeOperationalDataSet *foundation.NSData) error

Stores Thread network credentials into the framework database that a Border Agent provides.

StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion blocks until the operation completes or ctx is cancelled.

func (*THClient) Unwrap

func (x *THClient) Unwrap() *raw.THClient

Unwrap returns the underlying raw.THClient.

type THClientable

type THClientable interface {
	Unwrap() *raw.THClient
	RetrieveAllCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
	RetrieveAllActiveCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
	DeleteCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) error
	RetrieveCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) (*THCredentials, error)
	StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion(ctx context.Context, borderAgentID *foundation.NSData, activeOperationalDataSet *foundation.NSData) error
	RetrievePreferredCredentials(ctx context.Context) (*THCredentials, error)
	RetrieveCredentialsForExtendedPANIDCompletion(ctx context.Context, extendedPANID *foundation.NSData) (*THCredentials, error)
	CheckPreferredNetworkForActiveOperationalDatasetCompletion(activeOperationalDataSet *foundation.NSData, completion func(bool))
	IsPreferredNetworkAvailableWithCompletion(completion func(bool))
}

THClientable is the interface implemented by THClient, for mocking and DI.

type THCredentials

type THCredentials struct {
	// contains filtered or unexported fields
}

A class that contains credentials for a Thread network.

THCredentials wraps raw.THCredentials with a fluent Go API.

func NewTHCredentials

func NewTHCredentials() *THCredentials

NewTHCredentials creates a new THCredentials.

func THCredentialsFromID

func THCredentialsFromID(id objc.ID) *THCredentials

THCredentialsFromID adopts an existing object pointer as a THCredentials (nil for 0).

func (*THCredentials) ActiveOperationalDataSet

func (x *THCredentials) ActiveOperationalDataSet() *foundation.NSData

The essential operational parameters for the Thread network. The framework parses this property, then extracts and sets “THCredentials/channel“, “THCredentials/extendedPANID“, “THCredentials/networkKey“, “THCredentials/networkName“, “THCredentials/panID“, and “THCredentials/PSKC“ when you call “THClient/storeCredentialsForBorderAgent:activeOperationalDataSet:completion:“.

ActiveOperationalDataSet calls the underlying ActiveOperationalDataSet.

func (*THCredentials) BorderAgentID

func (x *THCredentials) BorderAgentID() *foundation.NSData

The identifer of an active Thread network Border Agent. This property’s value is the MAC Extended Address, a random identifier that the active Thread network border router generates.

BorderAgentID calls the underlying BorderAgentID.

func (*THCredentials) Channel

func (x *THCredentials) Channel() uint8

The Thread network radio channel.

Channel calls the underlying Channel.

func (*THCredentials) CreationDate

func (x *THCredentials) CreationDate() *foundation.NSDate

The date and time that the framework stored the credential in the database.

CreationDate calls the underlying CreationDate.

func (*THCredentials) ExtendedPANID

func (x *THCredentials) ExtendedPANID() *foundation.NSData

The Thread network extended PAN identifier.

ExtendedPANID calls the underlying ExtendedPANID.

func (*THCredentials) ID

func (x *THCredentials) ID() objc.ID

ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.

func (*THCredentials) LastModificationDate

func (x *THCredentials) LastModificationDate() *foundation.NSDate

The date and time that the framework updated the credential in the database.

LastModificationDate calls the underlying LastModificationDate.

func (*THCredentials) NetworkKey

func (x *THCredentials) NetworkKey() *foundation.NSData

The sixteen byte Thread network key.

NetworkKey calls the underlying NetworkKey.

func (*THCredentials) NetworkName

func (x *THCredentials) NetworkName() string

The Thread network name.

NetworkName calls the underlying NetworkName.

func (*THCredentials) PSKC

func (x *THCredentials) PSKC() *foundation.NSData

The sixteen byte Thread network pre-shared key for the Commissioner.

PSKC calls the underlying PSKC.

func (*THCredentials) PanID

func (x *THCredentials) PanID() *foundation.NSData

The two byte Thead network PAN identifier.

PanID calls the underlying PanID.

func (*THCredentials) SetChannel

func (x *THCredentials) SetChannel(channel uint8)

SetChannel calls the underlying SetChannel.

func (*THCredentials) Unwrap

func (x *THCredentials) Unwrap() *raw.THCredentials

Unwrap returns the underlying raw.THCredentials.

func (*THCredentials) WithChannel

func (x *THCredentials) WithChannel(channel uint8) *THCredentials

The Thread network radio channel.

WithChannel sets the channel property and returns the receiver for chaining.

type THCredentialsable

type THCredentialsable interface {
	Unwrap() *raw.THCredentials
	WithChannel(channel uint8) *THCredentials
	NetworkName() string
	ExtendedPANID() *foundation.NSData
	BorderAgentID() *foundation.NSData
	ActiveOperationalDataSet() *foundation.NSData
	NetworkKey() *foundation.NSData
	PSKC() *foundation.NSData
	Channel() uint8
	SetChannel(channel uint8)
	PanID() *foundation.NSData
	CreationDate() *foundation.NSDate
	LastModificationDate() *foundation.NSDate
}

THCredentialsable is the interface implemented by THCredentials, for mocking and DI.

Jump to

Keyboard shortcuts

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