feat(udp,http3): add UDP datagram handler relay support and stream HTTP/3 request bodies to backends
This commit is contained in:
@@ -123,10 +123,10 @@ export class RouteValidator {
|
||||
errors.push(`Invalid action type: ${route.action.type}. Must be one of: ${this.VALID_ACTION_TYPES.join(', ')}`);
|
||||
}
|
||||
|
||||
// Validate socket-handler
|
||||
// Validate socket-handler (TCP socketHandler or UDP datagramHandler)
|
||||
if (route.action.type === 'socket-handler') {
|
||||
if (typeof route.action.socketHandler !== 'function') {
|
||||
errors.push('socket-handler action requires a socketHandler function');
|
||||
if (typeof route.action.socketHandler !== 'function' && typeof route.action.datagramHandler !== 'function') {
|
||||
errors.push('socket-handler action requires a socketHandler or datagramHandler function');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,10 +620,12 @@ export function validateRouteAction(action: IRouteAction): { valid: boolean; err
|
||||
}
|
||||
|
||||
if (action.type === 'socket-handler') {
|
||||
if (!action.socketHandler) {
|
||||
errors.push('Socket handler function is required for socket-handler action');
|
||||
} else if (typeof action.socketHandler !== 'function') {
|
||||
if (!action.socketHandler && !action.datagramHandler) {
|
||||
errors.push('Socket handler or datagram handler function is required for socket-handler action');
|
||||
} else if (action.socketHandler && typeof action.socketHandler !== 'function') {
|
||||
errors.push('Socket handler must be a function');
|
||||
} else if (action.datagramHandler && typeof action.datagramHandler !== 'function') {
|
||||
errors.push('Datagram handler must be a function');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,7 +716,8 @@ export function hasRequiredPropertiesForAction(route: IRouteConfig, actionType:
|
||||
route.action.targets.length > 0 &&
|
||||
route.action.targets.every(t => t.host && t.port !== undefined);
|
||||
case 'socket-handler':
|
||||
return !!route.action.socketHandler && typeof route.action.socketHandler === 'function';
|
||||
return (!!route.action.socketHandler && typeof route.action.socketHandler === 'function') ||
|
||||
(!!route.action.datagramHandler && typeof route.action.datagramHandler === 'function');
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user