Start working on Go implementation

This commit is contained in:
Anthony Wang 2023-04-24 15:39:34 -04:00
parent 5cb3dff9d3
commit f2414e8a6b
Signed by: a
GPG Key ID: 42A5B952E6DD8D38
5 changed files with 50 additions and 24 deletions

.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
# Allowlisting gitignore template for GO projects prevents us
# from adding various unwanted local files, such as generated
# files, developer configurations or IDE-specific files etc.
# Recommended: Go.AllowList.gitignore
# Ignore everything
# But not these files...
# !Makefile
# ...even if they are in subdirectories

client/client.go Normal file
View File

@ -0,0 +1,7 @@
package client
import "fmt"
func main() {
fmt.Println("Hello, World!")

go.mod Normal file
View File

@ -0,0 +1,3 @@
go 1.20

View File

@ -1,24 +0,0 @@
# 6.5820 Proposal
## Group members
Anthony Wang, Daniel Wang, ??
## Idea
This project aims to use a distributed hash table to build a cryptographically secure federated messaging network with public-key based identity. The design is similar to other federated systems like email's and Mastodon's ActivityPub, but the crucial difference is that users are addressed by their public key, instead of a username@server address, and a DHT is used to resolve public keys to a user's server address.
An example for how this system works:
- Alice has an account on the server with public key 464658c26f2003d3. Bobert has an account on the server with public key cee5b4af3efaf109.
- Bobert tells Alice his public key so she can message him.
- Alice creates and signs a message with recipient cee5b4af3efaf109 and sends it to her server,
- This server must find out which server this recipient corresponds to in order to deliver the message.
- All the servers in the network form a distributed hash table that maps public keys to servers. sends out a request with cee5b4af3efaf109 to the DHT and soon receives a response with the answer,, signed by Bobert's private key.
- Finally, delivers the message to, where Bobert can now find it in his inbox.
The two main advantages of public-key identity of traditional username@server addresses are that it enables users to easily migrate between servers and that it simplifies cryptography. In addition, user accounts can belong to multiple servers, and user data is replicated using primary-backup replication.
## Implementation
We will use the Chord algorithm for the DHT and implement it in Go.

server/server.go Normal file
View File

@ -0,0 +1,17 @@
package main
import (
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))