nodeinfo

package module
v0.0.0-...-05a6c0c Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 9 Imported by: 0

README

go-nodeinfo

Package nodeinfo implements the NodeInfo protocol, for the Go programming language.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-nodeinfo

GoDoc

Import

There are separate sub-packages for each version of nodeinfo. So, would you import whichever packages you are interested in using.

To import package nodeinfo for nodeinfo 2.2 use import code like the following:

import "codeberg.org/reiver/go-nodeinfo/2.2"

To import package nodeinfo for nodeinfo 2.1 use import code like the following:

import "codeberg.org/reiver/go-nodeinfo/2.1"

To import package nodeinfo for nodeinfo 2.0 use import code like the following:

import "codeberg.org/reiver/go-nodeinfo/2.0"

To import package nodeinfo for nodeinfo 1.1 use import code like the following:

import "codeberg.org/reiver/go-nodeinfo/1.1"

To import package nodeinfo for nodeinfo 1.0 use import code like the following:

import "codeberg.org/reiver/go-nodeinfo/1.0"

Installation

To install package nodeinfo do the following:

GOPROXY=direct go get codeberg.org/reiver/go-nodeinfo

Author

Package nodeinfo was written by Charles Iliya Krempeaux

Documentation

Index

Constants

View Source
const DefaultPath string = "/.well-known/nodeinfo"

Variables

This section is empty.

Functions

func ServerText

func ServerText() string

ServerText returns the Server (name) used by any (internal) HTTP-server in this package when making an HTTP-response to any client.

For example:

import "codeberg.org/reiver/go-nodeinfo"

// ...

Server := nodeinfo.ServerText()

This can be changed to customize the Server (name) sent using SetServerText.

func SetServerText

func SetServerText(value string)

SetServerText sets the Server (name) used by any (internal) HTTP-server in this package when making an HTTP-response to any client.

For example:

import "codeberg.org/reiver/go-nodeinfo"

// ...

nodeinfo.SetServerText("Example/1.0.1 (hello world)")

You can get the value of the Server (name) by calling ServerText.

func SetUserAgentText

func SetUserAgentText(value string)

SetUserAgentText sets the User-Agent used by any (internal) HTTP-client in this package when making an HTTP-request to any server.

For example:

import "codeberg.org/reiver/go-nodeinfo"

// ...

nodeinfo.SetUserAgentText("ExampleAppt/2.71 (+http://example.com/example-app)")

You can get the value of the User-Agent by calling UserAgentText.

func UserAgentText

func UserAgentText() string

UserAgentText returns the User-Agent used by any (internal) HTTP-client in this package when making an HTTP-request to any server.

For example:

import "codeberg.org/reiver/go-nodeinfo"

// ...

userAgent := nodeinfo.UserAgentText()

This can be changed to customize the User-Agent sent using SetUserAgentText.

Types

type ResolvingWellKnown

type ResolvingWellKnown struct {
	WellKnown WellKnown
	Scheme    string
}

func (ResolvingWellKnown) ServeHTTP

func (receiver ResolvingWellKnown) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request)

type WellKnown

type WellKnown struct {
	NodeInfo2Dot2 opt.Optional[string]
	NodeInfo2Dot1 opt.Optional[string]
	NodeInfo2     opt.Optional[string]
	NodeInfo1Dot1 opt.Optional[string]
	NodeInfo1     opt.Optional[string]
}

func GetHost

func GetHost(host string) (WellKnown, error)

func GetURL

func GetURL(url string) (WellKnown, error)

func (WellKnown) MarshalJSON

func (receiver WellKnown) MarshalJSON() ([]byte, error)

func (WellKnown) ServeHTTP

func (receiver WellKnown) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request)

func (*WellKnown) UnmarshalJSON

func (receiver *WellKnown) UnmarshalJSON(bytes []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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