Categorygithub.com/writefreely/go-nodeinfo
modulepackage
1.2.0
Repository: https://github.com/writefreely/go-nodeinfo.git
Documentation: pkg.go.dev

# README

go-nodeinfo

GoDoc Discuss on our forum

go-nodeinfo is an implementation of NodeInfo, a standard metadata format for federated social networks, in Go (golang).

This fork contains extra metadata specifically for WriteFreely.

Usage

nodeinfo.Service integrates with your existing net/http server.

package main

import (
	"github.com/writefreely/go-nodeinfo"
	"net/http"
)

func main() {
	cfg := nodeinfo.Config{
		BaseURL: "http://localhost:8080",
		InfoURL: "/api/nodeinfo",

		Metadata: nodeinfo.Metadata{
			NodeName:        "Agora",
			NodeDescription: "A federated something-something.",
			Private:         false,
		},
		Protocols: []nodeinfo.NodeProtocol{
			nodeinfo.ProtocolActivityPub,
		},
		Services: nodeinfo.Services{
			Inbound: []nodeinfo.NodeService{},
			Outbound: []nodeinfo.NodeService{
				nodeinfo.ServiceTwitter,
				nodeinfo.ServiceTumblr,
			},
		},
		Software: nodeinfo.SoftwareInfo{
			Name:    "Agora",
			Version: "1.0",
		},
	}
	ni := nodeinfo.NewService(cfg, nodeInfoResolver{})

	http.Handle(nodeinfo.NodeInfoPath, http.HandlerFunc(ni.NodeInfoDiscover))
	http.Handle(cfg.InfoURL, http.HandlerFunc(ni.NodeInfo))

	http.ListenAndServe(":8080", nil)
}

type nodeInfoResolver struct{}

func (r nodeInfoResolver) IsOpenRegistration() (bool, error) {
	return true, nil
}

func (r nodeInfoResolver) Usage() (nodeinfo.Usage, error) {
	u := nodeinfo.Usage{
		Users: nodeinfo.UsageUsers{
			Total: 1,
		},
		LocalPosts: 1,
	}
	return u, nil
}

# Packages

No description provided by the author

# Functions

No description provided by the author

# Constants

NodeInfoPath defines the default path of the nodeinfo handler.
Protocols that can be supported by this node.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Services that can be supported (inbound or outbound) by this node's API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author