add go-tun2socks code

This commit is contained in:
Jason
2019-07-16 11:37:52 +08:00
parent 828ba9948d
commit 6d01dec5a4
301 changed files with 69694 additions and 1 deletions

21
core/udp_callback.go Normal file
View File

@@ -0,0 +1,21 @@
package core
/*
#cgo CFLAGS: -I./c/include
#include "lwip/udp.h"
extern void udpRecvFn(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port, const ip_addr_t *dest_addr, u16_t dest_port);
void
set_udp_recv_callback(struct udp_pcb *pcb, void *recv_arg) {
udp_recv(pcb, udpRecvFn, recv_arg);
}
*/
import "C"
import (
"unsafe"
)
func setUDPRecvCallback(pcb *C.struct_udp_pcb, recvArg unsafe.Pointer) {
C.set_udp_recv_callback(pcb, recvArg)
}