nodeinfo

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Overview

Package nodeinfo contains types and a simple client for reading the standard NodeInfo protocol described by Diaspora1.

This package supports version 2.02 because that is the one most commonly used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Version          string   `json:"version"`
	Software         Software `json:"software"`
	Protocols        []string `json:"protocols"`
	Services         Services `json:"services"`
	OpenRegistration bool     `json:"openRegistration"`
	Usage            Usage    `json:"usage"`
	Metadata         any      `json:"metadata"`
}

Node is the node information you are looking for.

func Fetch

func Fetch(ctx context.Context, nodeURL string) (*Node, error)

Fetch uses the standard library HTTP client to fetch node information.

func FetchWithClient

func FetchWithClient(ctx context.Context, cli *http.Client, nodeURL string) (*Node, error)

FetchWithClient uses the provided HTTP client to fetch node information.

type Services

type Services struct {
	Inbound  []string `json:"inbound"`
	Outbound []string `json:"outbound"`
}

Services lists the third party services that this server can connect to with their application API.

type Software

type Software struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Software contains metadata about the server software in use.

type Usage

type Usage struct {
	Users      Users `json:"users"`
	LocalPosts int64 `json:"localPosts"`
}

Usage statistics for this server.

type Users

type Users struct {
	Total          int64 `json:"total"`
	ActiveHalfYear int64 `json:"activeHalfYear"`
	ActiveMonth    int64 `json:"activeMonth"`
}

Users contains statistics about the users of this server.

Jump to

Keyboard shortcuts

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