()
| 50 | } |
| 51 | |
| 52 | func NewStdNetBind() Bind { |
| 53 | return &StdNetBind{ |
| 54 | udpAddrPool: sync.Pool{ |
| 55 | New: func() any { |
| 56 | return &net.UDPAddr{ |
| 57 | IP: make([]byte, 16), |
| 58 | } |
| 59 | }, |
| 60 | }, |
| 61 | |
| 62 | msgsPool: sync.Pool{ |
| 63 | New: func() any { |
| 64 | // ipv6.Message and ipv4.Message are interchangeable as they are |
| 65 | // both aliases for x/net/internal/socket.Message. |
| 66 | msgs := make([]ipv6.Message, IdealBatchSize) |
| 67 | for i := range msgs { |
| 68 | msgs[i].Buffers = make(net.Buffers, 1) |
| 69 | msgs[i].OOB = make([]byte, 0, stickyControlSize+gsoControlSize) |
| 70 | } |
| 71 | return &msgs |
| 72 | }, |
| 73 | }, |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | type StdNetEndpoint struct { |
| 78 | // AddrPort is the endpoint destination. |
no outgoing calls