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

23
.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...
!/.gitignore
!*.go
!go.sum
!go.mod
!README.md
!LICENSE
# !Makefile
# ...even if they are in subdirectories
!*/

7
client/client.go Normal file
View File

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

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.exozy.me/a/Kela
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 example.com with public key 464658c26f2003d3. Bobert has an account on the server mit.edu 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, example.com.
- 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. example.com sends out a request with cee5b4af3efaf109 to the DHT and soon receives a response with the answer, mit.edu, signed by Bobert's private key.
- Finally, example.com delivers the message to mit.edu, 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.

17
server/server.go Normal file
View File

@ -0,0 +1,17 @@
package main
import (
"fmt"
"html"
"log"
"net/http"
)
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))
}