- Go 100%
| badhost.go | ||
| createfediverseid_example_test.go | ||
| fediverseid.go | ||
| fediverseid_accturi_example_test.go | ||
| fediverseid_createfediverseid_example_test.go | ||
| fediverseid_emptyfediverseid_example_test.go | ||
| fediverseid_gostring_test.go | ||
| fediverseid_marshaltext_test.go | ||
| fediverseid_newfediverseid_example_test.go | ||
| fediverseid_newfediverseid_keyword_example_test.go | ||
| fediverseid_parsefediverseidbytes_example_test.go | ||
| fediverseid_parsefediverseidstring_example_test.go | ||
| fediverseid_string_example_test.go | ||
| fediverseid_test.go | ||
| fediverseid_unmarshaltext_test.go | ||
| fediverseid_unserialize_test.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| parsefediverseidbytes_test.go | ||
| parsefediverseidstring_test.go | ||
| README.md | ||
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
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