1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-12 08:23:58 +02:00
go-micro/plugins/transport/utp/utp.go

52 lines
860 B
Go
Raw Normal View History

2020-12-26 17:32:45 +02:00
// Package utp implements a utp transport
package utp
import (
"bufio"
"encoding/gob"
"net"
"time"
2021-10-12 13:55:53 +02:00
"go-micro.dev/v4/cmd"
"go-micro.dev/v4/transport"
2020-12-26 17:32:45 +02:00
)
type utpTransport struct {
opts transport.Options
}
type utpListener struct {
t time.Duration
l net.Listener
opts transport.ListenOptions
}
type utpClient struct {
dialOpts transport.DialOptions
conn net.Conn
enc *gob.Encoder
dec *gob.Decoder
encBuf *bufio.Writer
timeout time.Duration
}
type utpSocket struct {
conn net.Conn
enc *gob.Encoder
dec *gob.Decoder
encBuf *bufio.Writer
timeout time.Duration
}
func init() {
cmd.DefaultTransports["utp"] = NewTransport
}
func NewTransport(opts ...transport.Option) transport.Transport {
var options transport.Options
for _, o := range opts {
o(&options)
}
return &utpTransport{opts: options}
}