Documentation ¶
Index ¶
- Constants
- type TUDPTransport
- func (p *TUDPTransport) Addr() net.Addr
- func (p *TUDPTransport) Close() error
- func (p *TUDPTransport) Conn() *net.UDPConn
- func (p *TUDPTransport) Flush() error
- func (p *TUDPTransport) IsOpen() bool
- func (p *TUDPTransport) Open() error
- func (p *TUDPTransport) Read(buf []byte) (int, error)
- func (p *TUDPTransport) RemainingBytes() uint64
- func (p *TUDPTransport) Write(buf []byte) (int, error)
Constants ¶
const MaxLength = 65000
MaxLength of UDP packet
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TUDPTransport ¶
type TUDPTransport struct {
// contains filtered or unexported fields
}
TUDPTransport用于创建udp transport, 两个作用 1. 对于业务微服务,可以发起trace包传输; 2. 对于服务端,可以用来接收trace包.
func NewTUDPClientTransport ¶
func NewTUDPClientTransport(destHostPort string, locHostPort string) (*TUDPTransport, error)
NewTUDPClientTransport方法用于创建一个连接udp server,也就是processor server的client Example:
trans, err := thriftudp.NewTUDPClientTransport("192.168.1.1:9090", "")
func NewTUDPServerTransport ¶
func NewTUDPServerTransport(hostPort string) (*TUDPTransport, error)
NewTUDPServerTransport方法用于创建一个TUDPTransport实例, 创建一个udp server, 监听服务端口 Example:
trans, err := thriftudp.NewTUDPClientTransport("localhost:9001")
func (*TUDPTransport) Addr ¶
func (p *TUDPTransport) Addr() net.Addr
Addr returns the address that the transport is listening on or writing to
func (*TUDPTransport) Conn ¶
func (p *TUDPTransport) Conn() *net.UDPConn
Conn retrieves the underlying net.UDPConn
func (*TUDPTransport) Flush ¶
func (p *TUDPTransport) Flush() error
Flush flushes the write buffer as one udp packet
func (*TUDPTransport) IsOpen ¶
func (p *TUDPTransport) IsOpen() bool
IsOpen returns true if the connection is open
func (*TUDPTransport) Open ¶
func (p *TUDPTransport) Open() error
Open does nothing as connection is opened on creation Required to maintain thrift.TTransport interface
func (*TUDPTransport) Read ¶
func (p *TUDPTransport) Read(buf []byte) (int, error)
Read reads one UDP packet and puts it in the specified buf
func (*TUDPTransport) RemainingBytes ¶
func (p *TUDPTransport) RemainingBytes() uint64
RemainingBytes returns the max number of bytes (same as Thrift's StreamTransport) as we do not know how many bytes we have left.