proxy.js
/*
udp request relay
send udp msgs to each other
*/
udp request relay
send udp msgs to each other
udp request relay send udp msgs to each other
function relayUDP(socket, address, port, CMD_REPLY){
	console.log('[UDP]',`${socket.remoteAddress}`);
	let relay=new UDPRelay(socket, address, port, CMD_REPLY);
	relay.on('proxy_error',(relaySocket,direction,err)=>{
		console.error('	[UDP proxy error]',`[${direction}]`,err.message);
	});
	relay.relaySocket.once('close',()=>{
		console.log('  [UDP closed]',socket.remoteAddress);
	});
	relay.on('message',(fromClient,packet)=>{
		fromClient;
		packet.address;
		packet.port;
		packet.data;
		packet.address;
		packet.port;
		packet.data;
	});
	relay.packetHandler=async (fromClient,packet)=>{
	};
}
function relayUDP ( socket , address , port , CMD_REPLY ) { console . log ( '[UDP]' , ` ${ socket . remoteAddress } ` ) ; let relay = new UDPRelay ( socket , address , port , CMD_REPLY ) ; relay . on ( 'proxy_error' , ( relaySocket , direction , err ) => { console . error ( '	[UDP proxy error]' , ` ${ direction } ` , err . message ) ; } ) ; relay . relaySocket . once ( 'close' , ( ) => { console . log ( '  [UDP closed]' , socket . remoteAddress ) ; } ) ; relay . on ( 'message' , ( fromClient , packet ) => { fromClient ; packet . address ; packet . port ; packet . data ; packet . address ; packet . port ; packet . data ; } ) ; relay . packetHandler = async ( fromClient , packet ) => { } ; }
udp request relay
send udp msgs to each other
udp request relay send udp msgs to each other
//example for modify data sync
 //is this packet from the client
 // when fromClient is true
 //target address
 //target port
 //client sent data
 // when fromClient is false
 //source address
 //source port
 //data
 //If the packet was not from the client, modification on addreses and
 //port will not take effect, because the packet must be sent back
 //to the client
 //example for modify data async
 //same with previous
