wifi

package
v1.57.7 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

View Source
var TimeLimit = 25 * time.Second

Functions

func CheckConnection

func CheckConnection(timeout time.Duration) error

func CheckHotspotSupported

func CheckHotspotSupported(ctx context.Context) (supported bool, err error)

func CheckIfIsConnected

func CheckIfIsConnected(ctx context.Context, interfaceName string) error

func CheckIfIsConnectedWifi added in v1.54.11

func CheckIfIsConnectedWifi(ctx context.Context, interfaceName string) error

func ConnectToSavedWifi

func ConnectToSavedWifi(ctx context.Context) error

func ConnectWifi

func ConnectWifi(ctx context.Context, creds Credentials) error

func DeleteConnection

func DeleteConnection(ctx context.Context, connectionName string)

func DisconnectFromExternalWifi added in v1.14.0

func DisconnectFromExternalWifi(ctx context.Context) error

func DisconnectWifi

func DisconnectWifi(ctx context.Context) error

func EnsureHotspotActive added in v1.55.15

func EnsureHotspotActive(ctx context.Context) error

EnsureHotspotActive makes sure the hotspot is active, even if it was already started This is used as a fallback when Wi-Fi connection fails

func FetchAIResponse added in v1.55.1

func FetchAIResponse(ctx context.Context, aiModel string, userMessage string) (<-chan string, error)

func FetchContainerLogs added in v1.44.0

func FetchContainerLogs(ctx context.Context, req FetchContainerLogsRequest) (string, error)

func FindBestAndTargetInLogs added in v1.54.9

func FindBestAndTargetInLogs(ctx context.Context, req FindBestAndTargetInLogsRequest) (string, string, error)

Usage example: best, target, err := findBestAndTargetInLogs(context.Background(), "fula_node")

if err != nil {
    log.Fatalf("Error: %s", err)
}

log.Printf("Best: %s, Target: %s", best, target)

func GeneratePrivateKeyFromSeed

func GeneratePrivateKeyFromSeed(seed string) (string, error)

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

func GetClusterPeerIDFromIdentity added in v1.57.5

func GetClusterPeerIDFromIdentity() (string, error)

GetClusterPeerIDFromIdentity derives the ipfs-cluster peerID from the identity field in config.yaml. The identity is the base64-encoded private key that ipfs-cluster uses directly (no HMAC derivation like kubo).

func GetHardwareID

func GetHardwareID() (string, error)

func GetKuboPeerID added in v1.57.3

func GetKuboPeerID() (string, error)

GetKuboPeerID reliably returns kubo's peerID without depending on ipfs-cluster. It first queries the kubo API, then falls back to reading from the config file.

func RunCommand

func RunCommand(ctx context.Context, commands string) (stdout, stderr string, err error)

exported

func StartHotspot

func StartHotspot(ctx context.Context, forceReload bool) error

startHotspot can be used to get the list of available wifis and their strength If forceReload is set to true it resets the network adapter to make sure it fetches the latest list, otherwise it reads from cache wifiInterface is the name of interface that it should look for in Linux.

func StopHotspot

func StopHotspot(ctx context.Context) error

Types

type BloxFreeSpaceRequest added in v1.0.0

type BloxFreeSpaceRequest struct {
}

type BloxFreeSpaceResponse

type BloxFreeSpaceResponse struct {
	DeviceCount    int     `json:"device_count"`
	Size           float32 `json:"size"`
	Used           float32 `json:"used"`
	Avail          float32 `json:"avail"`
	UsedPercentage float32 `json:"used_percentage"`
}

func GetBloxFreeSpace

func GetBloxFreeSpace() (BloxFreeSpaceResponse, error)

type ChatWithAIRequest added in v1.55.1

type ChatWithAIRequest struct {
	AIModel     string `json:"ai_model"`
	UserMessage string `json:"user_message"`
}

type ChatWithAIResponse added in v1.55.1

type ChatWithAIResponse struct {
	Status bool   `json:"status"`
	Msg    string `json:"msg"`
}

type Config

type Config struct {
	StoreDir string `yaml:"storeDir"`
}

type Credentials

type Credentials struct {
	SSID        string
	Password    string
	CountryCode string
}

type DeleteFulaConfigRequest added in v1.14.0

type DeleteFulaConfigRequest struct {
}

type DeleteFulaConfigResponse added in v1.14.0

type DeleteFulaConfigResponse struct {
	Msg    string `json:"msg"`
	Status bool   `json:"status"`
}

func DeleteFulaConfig added in v1.14.0

func DeleteFulaConfig(ctx context.Context) DeleteFulaConfigResponse

type DeleteWifiRequest added in v1.17.0

type DeleteWifiRequest struct {
	ConnectionName string `json:"name"`
}

type DeleteWifiResponse added in v1.17.0

type DeleteWifiResponse struct {
	Msg    string `json:"msg"`
	Status bool   `json:"status"`
}

func DeleteWifi added in v1.17.0

func DisconnectNamedWifi added in v1.17.0

func DisconnectNamedWifi(ctx context.Context, req DeleteWifiRequest) DeleteWifiResponse

type DockerImageBuildDate added in v1.57.2

type DockerImageBuildDate struct {
	ContainerName string `json:"container_name"`
	ImageName     string `json:"image_name"`
	ImageCreated  string `json:"image_created"`
	ImageDigest   string `json:"image_digest"`
}

type DockerInfo

type DockerInfo struct {
	Image       string            `json:"image"`
	Version     string            `json:"version"`
	ID          string            `json:"id"`
	Labels      map[string]string `json:"labels"`
	Created     string            `json:"created"`
	RepoDigests []string          `json:"repo_digests"`
}

func GetContainerInfo

func GetContainerInfo(containerName string) (DockerInfo, error)

type EraseBlDataRequest added in v1.30.0

type EraseBlDataRequest struct {
}

type EraseBlDataResponse added in v1.30.0

type EraseBlDataResponse struct {
	Status bool   `json:"status"`
	Msg    string `json:"msg"`
}

func EraseBlData added in v1.30.0

func EraseBlData(ctx context.Context) EraseBlDataResponse

type FetchContainerLogsRequest added in v1.44.0

type FetchContainerLogsRequest struct {
	ContainerName string
	TailCount     string
}

type FetchContainerLogsResponse added in v1.44.0

type FetchContainerLogsResponse struct {
	Status bool   `json:"status"`
	Msg    string `json:"msg"`
}

type FindBestAndTargetInLogsRequest added in v1.54.9

type FindBestAndTargetInLogsRequest struct {
	NodeContainerName string
	TailCount         string
}

type FindBestAndTargetInLogsResponse added in v1.54.9

type FindBestAndTargetInLogsResponse struct {
	Best   string `json:"best"`
	Target string `json:"target"`
	Err    string `json:"err"`
}

type GetClusterInfoRequest added in v1.57.2

type GetClusterInfoRequest struct{}

Cluster info

type GetClusterInfoResponse added in v1.57.2

type GetClusterInfoResponse struct {
	ClusterPeerID   string `json:"cluster_peer_id"`
	ClusterPeerName string `json:"cluster_peer_name"`
}

func GetClusterInfo added in v1.57.2

func GetClusterInfo() (GetClusterInfoResponse, error)

type GetDatastoreSizeRequest added in v1.48.0

type GetDatastoreSizeRequest struct {
}

type GetDatastoreSizeResponse added in v1.48.0

type GetDatastoreSizeResponse struct {
	RepoSize   string `json:"size"`
	StorageMax string `json:"storage_max"`
	NumObjects string `json:"count"`
	RepoPath   string `json:"folder_path"`
	Version    string `json:"version"`
}

func GetDatastoreSize added in v1.48.0

type GetDockerImageBuildDatesRequest added in v1.57.2

type GetDockerImageBuildDatesRequest struct{}

Docker image build dates

type GetDockerImageBuildDatesResponse added in v1.57.2

type GetDockerImageBuildDatesResponse struct {
	Images []DockerImageBuildDate `json:"images"`
}

func GetDockerImageBuildDates added in v1.57.2

func GetDockerImageBuildDates() (GetDockerImageBuildDatesResponse, error)

type GetFolderSizeRequest added in v1.45.0

type GetFolderSizeRequest struct {
	FolderPath string `json:"folder_path"`
}

type GetFolderSizeResponse added in v1.45.0

type GetFolderSizeResponse struct {
	FolderPath  string `json:"folder_path"`
	SizeInBytes string `json:"size"`
}

func GetFolderSize added in v1.45.0

type Message added in v1.55.1

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type PartitionRequest added in v1.14.0

type PartitionRequest struct {
}

type PartitionResponse added in v1.14.0

type PartitionResponse struct {
	Msg    string `json:"msg"`
	Status bool   `json:"status"`
}

func Partition added in v1.14.0

func Partition(ctx context.Context) PartitionResponse

type Payload added in v1.55.1

type Payload struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Stream   bool      `json:"stream"`
}

type RebootRequest added in v1.0.0

type RebootRequest struct {
}

type RebootResponse added in v1.0.0

type RebootResponse struct {
	Msg    string `json:"msg"`
	Status bool   `json:"status"`
}

func Reboot added in v1.0.0

func Reboot(ctx context.Context) RebootResponse

type SyncInfo added in v1.44.0

type SyncInfo struct {
	Best      string
	Target    string
	Finalized string
	Speed     string
}

type Wifi

type Wifi struct {
	ESSID string `json:"essid"`
	SSID  string `json:"ssid"`
	RSSI  int    `json:"rssi"`
}

Wifi is the data structure containing the basic elements

func Scan

func Scan(forceReload bool, wifiInterface ...string) (wifilist []Wifi, err error)

Scan can be used to get the list of available wifis and their strength If forceReload is set to true it resets the network adapter to make sure it fetches the latest list, otherwise it reads from cache wifiInterface is the name of interface that it should look for in Linux.

type WifiRemoveallRequest added in v1.0.0

type WifiRemoveallRequest struct {
}

type WifiRemoveallResponse added in v1.0.0

type WifiRemoveallResponse struct {
	Msg    string `json:"msg"`
	Status bool   `json:"status"`
}

func WifiRemoveall added in v1.0.0

func WifiRemoveall(ctx context.Context) WifiRemoveallResponse

Jump to

Keyboard shortcuts

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