https://github.com/deadlysurgeon/rotaryphone
Golang Listener and Client binder using net.Pipe
https://github.com/deadlysurgeon/rotaryphone
golang golang-library http networking unit-testing
Last synced: about 1 year ago
JSON representation
Golang Listener and Client binder using net.Pipe
- Host: GitHub
- URL: https://github.com/deadlysurgeon/rotaryphone
- Owner: DeadlySurgeon
- Created: 2024-12-21T02:56:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-21T03:14:37.000Z (over 1 year ago)
- Last Synced: 2025-02-14T19:51:51.799Z (over 1 year ago)
- Topics: golang, golang-library, http, networking, unit-testing
- Language: Go
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rotary Phone
A Listener and Client binder using [net.Pipe](https://pkg.go.dev/net#Pipe).
## Usage:
```go
// Setup Rotary Phone Binder
conn := rotaryphone.New()
defer conn.Close()
// Setup Server bound to the Rotary Phone
wg := &sync.WaitGroup{}
wg.Add(1)
server := &http.Server{Handler: setupMux()}
go func() {
defer wg.Done()
_ = server.Serve(conn)
}()
defer wg.Wait()
defer server.Close()
// Create a new HTTP client
client := conn.Client()
// Form and execute request
req := formRequest()
client.Do(req)
```