Package fediverseid provides tools for working with Fediverse-IDs (ex: @[email protected]), for the Go programming language.
Find a file
2025-09-03 15:11:29 -07:00
badhost.go initial code 2025-01-15 17:53:16 -08:00
createfediverseid_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid.go docs 2025-02-05 09:34:31 -08:00
fediverseid_accturi_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_createfediverseid_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_emptyfediverseid_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_gostring_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_marshaltext_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_newfediverseid_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_newfediverseid_keyword_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_parsefediverseidbytes_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_parsefediverseidstring_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_string_example_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_unmarshaltext_test.go codeberg 2025-09-03 15:11:29 -07:00
fediverseid_unserialize_test.go codeberg 2025-09-03 15:11:29 -07:00
go.mod codeberg 2025-09-03 15:11:29 -07:00
go.sum go.* 2025-01-15 17:45:19 -08:00
LICENSE initial commits 2025-01-15 17:45:07 -08:00
parsefediverseidbytes_test.go codeberg 2025-09-03 15:11:29 -07:00
parsefediverseidstring_test.go codeberg 2025-09-03 15:11:29 -07:00
README.md codeberg 2025-09-03 15:11:29 -07:00

go-fediverseid

Package fediverseid implements tools for working with Fediverse-IDs, for the Go programming language.

Fediverse-IDs look like these:

Documention

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

GoDoc

Origin

Fediverse-ID are derived from Twitter-IDs, such:

  • @reiver
  • @twitter
  • @golanggo

Twitter-IDs were not invented by the Twitter company. Instead, users of Twitter started using them on Twitter as a way of replying to other people on Twitter. The Twitter company noticed this, and then (the Twitter company) built this into Twitter.

Twitter users started using Twitter-IDs because this convention of putting an at-symbol ("@") in front of someone's handle to reply to them already existing on blogs, and web-based bulletin boards / forums. Although on blogs, and web-based bulletin boards / forums, the @handle convention was often hyper-linked to the post that was being replied to.

Some people try to trace a history for Fediverse-IDs to e-mail addresses — these people are wrong. E-Mail addresses are compared to Fediverse-IDs as a way of helping people understand what Fediverse-IDs are. The origin of the Fediverse-IDs does not go back to e-mail addresses — it instead goes back to Twitter, blogs, and web-based bulletin boards / forums.

Examples

To parse a Fediverse-ID and split it into its name and host you can do something similar to the following:

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

// ...

fediverseID, err := fediverseid.ParseFediverseIDString("@[email protected]")
if nil != err {
	fmt.Printf("ERROR: problem parsing fediverse-id: %s\n", err)
	return
}

name, found := fediverseID.Name()
if !found {
	fmt.Println("ERROR: missing name")
	return
}

host, found := fediverseID.Host()
if !found {
	fmt.Println("ERROR: missing host")
	return
}

And, to generate a Fediverse-ID from a name and a host you can do something similar to the following:

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

// ...

fid := fediverseid.CreateFediverseID("joeblow", "host.example")

var serializedFediverseID string = fediverseID.String()

Import

To import package fediverseid use import code like the following:

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

Installation

To install package fediverseid do the following:

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

Author

Package fediverseid was written by Charles Iliya Krempeaux