aboutsummaryrefslogtreecommitdiff
path: root/transport/tcp.go
diff options
context:
space:
mode:
Diffstat (limited to 'transport/tcp.go')
-rw-r--r--transport/tcp.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/transport/tcp.go b/transport/tcp.go
new file mode 100644
index 0000000..2ab946a
--- /dev/null
+++ b/transport/tcp.go
@@ -0,0 +1,22 @@
+package transport
+
+import (
+ "context"
+ "net"
+)
+
+type TCP struct {
+ Bind string
+}
+
+func (t *TCP) Run(ctx context.Context, resolver Resolver) error {
+ ln, _ := net.Listen("tcp", t.Bind)
+
+ for {
+ conn, err := ln.Accept()
+ if err != nil {
+ return err
+ }
+ go resolver.Resolve(ctx, conn, conn)
+ }
+}