// Processes a UDP packet. For when you're handling UDP yourself. func (c *UTPContext) ProcessUDP(buf []byte, len int, to *syscall.RawSockaddr, tolen int) int { bufptr := (*C.byte)(unsafe.Pointer(&buf[0])) adrptr := (*C.struct_sockaddr)(unsafe.Pointer(to)) return int(C.utp_process_udp(c.raw, bufptr, C.size_t(len), adrptr, C.socklen_t(tolen))) }
//UtpProcessUDP process one udp packet func (ctx *UtpContext) UtpProcessUDP(buf []byte, addr *net.UDPAddr) int64 { addrinfo := C.getAddrInfo(C.CString(addr.IP.String()), (C.int)(addr.Port)) size := C.utp_process_udp(ctx.ctx, (*C.byte)(&buf[0]), (C.size_t)(len(buf)), addrinfo.ai_addr, (C.socklen_t)(addrinfo.ai_addrlen)) C.freeaddrinfo(addrinfo) return (int64)(size) }