Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aojea/hairpin
Hairpin creates a synchronous, in-memory, half-duplex connection. Data write on the connection is processed and sent back.
https://github.com/aojea/hairpin
golang network
Last synced: 18 days ago
JSON representation
Hairpin creates a synchronous, in-memory, half-duplex connection. Data write on the connection is processed and sent back.
- Host: GitHub
- URL: https://github.com/aojea/hairpin
- Owner: aojea
- License: apache-2.0
- Created: 2021-09-28T07:43:10.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-28T15:54:26.000Z (about 3 years ago)
- Last Synced: 2023-07-27T21:55:01.307Z (over 1 year ago)
- Topics: golang, network
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hairpin
Hairpin creates a synchronous, in-memory, half-duplex connection, and allows to set
a custom function to process the data that is going through the connection.The data written in the connection is executed by the custom Handler and sent back to the connection.
Operations are serialized, once a packet is processed, Writes() are blocked until the processed packet is Read().Partial Reads are allowed, but Writes() will not be unblocked until the Read() buffer is fully drained.
Hairpin implements golang net.Conn interface and is very useful for protocol testing.
## Example
Implement an in-memory DNS resolver using a custom handler that is able to process DNS requests
https://github.com/aojea/mem-resolver