public async Task <IActionResult> AddChannelAsync(AddChannleInputDto input) { if (!IPAddress.TryParse(input.PrivateIp, out IPAddress address)) { return(Json(new ResultDto { Success = false, Message = "privateIp is invalid" })); } var channels = await configHelper.GetChannelsAsync(input.ClientId); if (channels.Any(x => x.BackendPort == input.PublicPort)) { return(Json(new ResultDto { Success = false, Message = "public port already exists" })); } await configHelper.AddChannelAsync(new ChannelConfig { BackendPort = input.PublicPort, FrontendIp = input.PrivateIp, FrontendPort = input.PrivatePort, Name = input.Name, ClientId = input.ClientId }); return(Json(new ResultDto { Success = true })); }