diff options
author | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2022-05-21 20:38:21 +0300 |
---|---|---|
committer | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2022-05-21 20:38:21 +0300 |
commit | 81389df9484c28dfcec1cf7592b8d0f8b7e4e8e1 (patch) | |
tree | 7a7d0440481e45b999e828b1e5ba2b28129658bc /transport/tcp.go | |
parent | d4708a3665e546eea57611b17441ad9b8c89e9a4 (diff) |
Improvments. Breaking changes
Diffstat (limited to 'transport/tcp.go')
-rw-r--r-- | transport/tcp.go | 22 |
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) + } +} |