Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bit of troubleshooting steps for a failed advert attempt. #23

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions SS14.ServerHub/Controllers/ServerListController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public async Task<IActionResult> Advertise([FromBody] ServerAdvertise advertise)
if (!Uri.TryCreate(advertise.Address, UriKind.Absolute, out var parsedAddress) ||
string.IsNullOrWhiteSpace(parsedAddress.Host) ||
parsedAddress.Scheme is not (Ss14UriHelper.SchemeSs14 or Ss14UriHelper.SchemeSs14s))
return BadRequest("Invalid SS14 URI");
return BadRequest("Invalid SS14 URI. Ensure your hub.server_url starts with ss14:// or ss14s:// and that the address is valid.");

// Ban check.
switch (await CheckAddressBannedAsync(parsedAddress))
Expand All @@ -112,7 +112,7 @@ parsedAddress.Scheme is not (Ss14UriHelper.SchemeSs14 or Ss14UriHelper.SchemeSs1
Debug.Assert(statusJson != null);
Debug.Assert(infoJson != null);

switch (await CheckInfoBannedAsync(parsedAddress, statusJson, infoJson!))
switch (await CheckInfoBannedAsync(parsedAddress, statusJson, infoJson))
{
case BanCheckResult.Banned:
return Unauthorized("Your server has been blocked from advertising on the hub. If you believe this to be in error, please contact us.");
Expand Down Expand Up @@ -214,8 +214,8 @@ parsedAddress.Scheme is not (Ss14UriHelper.SchemeSs14 or Ss14UriHelper.SchemeSs1
}
catch (Exception e)
{
_logger.LogInformation(e, "Failed to connect to advertising server");
return (UnprocessableEntity("Unable to contact status address"), null, null);
_logger.LogInformation(e, $"Failed to connect to advertising server: {uri}");
return (UnprocessableEntity("Unable to contact status address, ensure your firewall/port forwarding configuration allows traffic from the internet and double check your config."), null, null);
}
}

Expand Down Expand Up @@ -314,4 +314,4 @@ public override void Write(Utf8JsonWriter writer, RawJson value, JsonSerializerO
writer.WriteRawValue(value.Json, skipInputValidation: true);
}
}
}
}
Loading