diff --git a/_examples/tcp/.gitignore b/_examples/sockets/.gitignore similarity index 100% rename from _examples/tcp/.gitignore rename to _examples/sockets/.gitignore diff --git a/_examples/tcp/Makefile b/_examples/sockets/Makefile similarity index 100% rename from _examples/tcp/Makefile rename to _examples/sockets/Makefile diff --git a/_examples/tcp/README.md b/_examples/sockets/README.md similarity index 80% rename from _examples/tcp/README.md rename to _examples/sockets/README.md index 6eada5a..5928625 100644 --- a/_examples/tcp/README.md +++ b/_examples/sockets/README.md @@ -1,6 +1,6 @@ -# tcp +# sockets -- makes a connection to tcpbin.com:4242 +- makes a TCP connection to tcpbin.com:4242. ## Development diff --git a/_examples/tcp/go.mod b/_examples/sockets/go.mod similarity index 100% rename from _examples/tcp/go.mod rename to _examples/sockets/go.mod diff --git a/_examples/tcp/go.sum b/_examples/sockets/go.sum similarity index 100% rename from _examples/tcp/go.sum rename to _examples/sockets/go.sum diff --git a/_examples/tcp/main.go b/_examples/sockets/main.go similarity index 77% rename from _examples/tcp/main.go rename to _examples/sockets/main.go index 2c33912..767405b 100644 --- a/_examples/tcp/main.go +++ b/_examples/sockets/main.go @@ -11,12 +11,7 @@ import ( func main() { handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - dialer, err := sockets.NewDialer(req.Context(), nil) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - conn, err := dialer.Dial(req.Context(), "tcp", "tcpbin.com:4242") + conn, err := sockets.Connect(req.Context(), "tcpbin.com:4242", nil) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return diff --git a/_examples/tcp/wrangler.toml b/_examples/sockets/wrangler.toml similarity index 54% rename from _examples/tcp/wrangler.toml rename to _examples/sockets/wrangler.toml index 6872846..3ff7386 100644 --- a/_examples/tcp/wrangler.toml +++ b/_examples/sockets/wrangler.toml @@ -1,6 +1,6 @@ -name = "tcp" +name = "sockets" main = "./build/worker.mjs" -compatibility_date = "2023-02-24" +compatibility_date = "2024-01-03" [build] command = "make build"