go-nodeinfo: github.com/writeas/go-nodeinfo Index | Files | Directories

package nodeinfo

import "github.com/writeas/go-nodeinfo"


Package Files

nodeinfo.go resolver.go routes.go service.go


const (
    // Protocols that can be supported by this node.
    ProtocolActivityPub NodeProtocol = "activitypub"
    ProtocolBuddyCloud               = "buddycloud"
    ProtocolDFRN                     = "dfrn"
    ProtocolDisaspora                = "diaspora"
    ProtocolLibertree                = "libertree"
    ProtocolOStatus                  = "ostatus"
    ProtocolPumpIO                   = "pumpio"
    ProtocolTent                     = "tent"
    ProtocolXMPP                     = "xmpp"
    ProtocolZot                      = "zot"

    // Services that can be supported (inbound or outbound) by this node's API.
    ServiceAtom      NodeService = "atom1.0"
    ServiceGNUSocial             = "gnusocial"
    ServiceIMAP                  = "imap"
    ServicePnut                  = "pnut"
    ServicePOP3                  = "pop3"
    ServicePumpIO                = "pumpio"
    ServiceRSS                   = "rss2.0"
    ServiceTwitter               = "twitter"
    ServiceTumblr                = "tumblr"
const NodeInfoPath = "/.well-known/nodeinfo"

NodeInfoPath defines the default path of the nodeinfo handler.

type Config Uses

type Config struct {
    BaseURL   string
    InfoURL   string
    Metadata  Metadata
    Protocols []NodeProtocol
    Services  Services
    Software  SoftwareInfo

type Metadata Uses

type Metadata struct {
    NodeName        string       `json:"nodeName,omitempty"`
    NodeDescription string       `json:"nodeDescription,omitempty"`
    Private         bool         `json:"private,omitempty"`
    Software        SoftwareMeta `json:"software,omitempty"`

Metadata for nodeinfo. Properties are based on what Pleroma uses.

From the spec: Free form key value pairs for software specific values. Clients should not rely on any specific key present.

type NodeInfo Uses

type NodeInfo struct {
    Metadata          Metadata       `json:"metadata"`
    OpenRegistrations bool           `json:"openRegistrations"`
    Protocols         []NodeProtocol `json:"protocols"`
    Services          Services       `json:"services"`
    Software          SoftwareInfo   `json:"software"`
    Usage             Usage          `json:"usage"`
    Version           string         `json:"version"`

NodeInfo includes all required node info.

type NodeProtocol Uses

type NodeProtocol string

type NodeService Uses

type NodeService string

type Resolver Uses

type Resolver interface {
    // IsOpenRegistration returns whether or not registration is open on this node.
    IsOpenRegistration() (bool, error)
    // Usage returns usage stats for this node.
    Usage() (Usage, error)

type Service Uses

type Service struct {
    InfoURL string
    Info    NodeInfo
    // contains filtered or unexported fields

func NewService Uses

func NewService(cfg Config, r Resolver) *Service

func (Service) BuildInfo Uses

func (s Service) BuildInfo() NodeInfo

func (*Service) NodeInfo Uses

func (s *Service) NodeInfo(w http.ResponseWriter, r *http.Request)

func (*Service) NodeInfoDiscover Uses

func (s *Service) NodeInfoDiscover(w http.ResponseWriter, r *http.Request)

type Services Uses

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

type SoftwareInfo Uses

type SoftwareInfo struct {
    // Name (canonical) of this server software.
    Name string `json:"name"`
    // Version of this server software.
    Version string `json:"version"`

type SoftwareMeta Uses

type SoftwareMeta struct {
    HomePage string `json:"homepage"`
    GitHub   string `json:"github"`
    Follow   string `json:"follow"`

type Usage Uses

type Usage struct {
    Users         UsageUsers `json:"users"`
    LocalPosts    int        `json:"localPosts,omitempty"`
    LocalComments int        `json:"localComments,omitempty"`

Usage is usage statistics for this server.

type UsageUsers Uses

type UsageUsers struct {
    Total          int `json:"total,omitempty"`
    ActiveHalfYear int `json:"activeHalfyear,omitempty"`
    ActiveMonth    int `json:"activeMonth,omitempty"`



Package nodeinfo imports 4 packages (graph) and is imported by 3 packages. Updated 2018-08-10. Refresh now. Tools for package owners.