REDESIGN MP2 IN GO

This commit is contained in:
Aryan Singh committed 2026-10-24 23:48:17 -05:00
1 parent 2fa715dfc0
commit 0e75fdc050
10 files changed
+327 -11

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
package main
import (
// "fmt"
"net"
"os"
"time"
// "net"
"context"
"log/slog"
)
type Config struct{
introducer_ip string
port int
my_ip *net.IP
gossip_heartbeat_interval time.Duration
join_retry_interval time.Duration
gossip_fanout int
gossip_failure_timeout time.Duration
}
func main(){
ctx := context.TODO()
logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
//dial up trick to get my_ip
conn, _ := net.Dial("udp", "8.8.8.8:80"); defer conn.Close(); my_ip := conn.LocalAddr().(*net.UDPAddr).IP
config := Config{"172.22.156.3", 8989, &my_ip, 250 * time.Millisecond, 1 * time.Second, 2, 6 * time.Second}
start_membership(ctx, config, logger)
}