Documentation ¶
Index ¶
- type PacketTransport
- func (u *PacketTransport) Close(context.Context) error
- func (u *PacketTransport) RecvFrom(ctx context.Context) (common.RawBytes, net.Addr, error)
- func (u *PacketTransport) SendMsgTo(ctx context.Context, b common.RawBytes, address net.Addr) error
- func (u *PacketTransport) SendUnreliableMsgTo(ctx context.Context, b common.RawBytes, address net.Addr) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PacketTransport ¶
type PacketTransport struct {
// contains filtered or unexported fields
}
PacketTransport implements interface Transport by wrapping around a net.PacketConn. The reliability of the underlying net.PacketConn defines the semantics behind SendMsgTo and SendUnreliableMsgTo.
For PacketTransports running on top of UDP, both SendMsgTo and SendUnreliableMsgTo are unreliable.
For PacketTransports running on top of UNIX domain socket with SOCK_DGRAM or Reliable socket, both SendMsgTo and SendUnreliableMsgTo guarantee reliable delivery to the other other end of the socket. Note that in this case, the reliability only extends to the guarantee that the message was not lost in transfer. It is not a guarantee that the server has read and processed the message.
func NewPacketTransport ¶
func NewPacketTransport(conn net.PacketConn) *PacketTransport