MCPcopy
hub / github.com/MetaCubeX/mihomo / WriteTo

Method WriteTo

transport/shadowsocks/shadowstream/packet.go:70–79  ·  view source on GitHub ↗
(b []byte, addr net.Addr)

Source from the content-addressed store, hash-verified

68const maxPacketSize = 64 * 1024
69
70func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error) {
71 buf := pool.Get(maxPacketSize)
72 defer pool.Put(buf)
73 buf, err := Pack(buf, b, c.Cipher)
74 if err != nil {
75 return 0, err
76 }
77 _, err = c.EnhancePacketConn.WriteTo(buf, addr)
78 return len(b), err
79}
80
81func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
82 n, addr, err := c.EnhancePacketConn.ReadFrom(b)

Callers

nothing calls this directly

Calls 4

GetFunction · 0.92
PutFunction · 0.92
PackFunction · 0.70
WriteToMethod · 0.65

Tested by

no test coverage detected