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

AddressParser-related changes and fixes #371

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Ampflower
Copy link
Contributor

  • Requires MixinExtras; it can be JiJ'd if you wish to maintain older Fabric Loader support for older versions of Minecraft.
    • Local sharing is used to avoid using a brittle ThreadLocal.
  • Rewrites AddressParser to be immutable and to have utility functions.
    • Able to do port parsing (necessary for some of the fixes needed)
    • Prefix-based parsing (for IPv6; may not be necessary with a clever inject point for the newer UI)
    • Tests via TestNG to ensure that both well-formed and malformed URIs parse as expected.
      • This includes conformance to how the previous parser parsed URIs; the semantic can be changed if needed.
  • Strips Via metadata before handing it off to the HostAndPort parser, then reappends it back after via local sharing.
  • Strips Via metadata before sending the address to the server.
  • Believes to be able to fix .viafabric suffix isn't working? #210 (untested; need host).

Prefix Parsing

viafabric.v1.8;localhost is now valid. Additional meta, such as versions, can be separated by +, like for example, viafabric.v1.18+v-2;localhost.

Note, to minimise rewriting more than is necessary, any additional versions specified after the first will be ignored, conforming to the original parser's behavior for both the new and old syntax.

- Port support
- Prefix support to allow IPv6 usage in modern versions
Copy link
Member

@Kichura Kichura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things i noticed in first reviewable commit.

@@ -142,6 +142,8 @@ dependencies {

includeJ8("com.viaversion:viaversion:${rootProject.viaver_version}")
include("com.github.TinfoilMC:ClientCommands:1.1.0")

testImplementation("org.testng:testng:6.13.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is TestNG not on 7.10.2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradle refused to resolve it, and that was the version IntelliJ 2022.2.2 suggested.

I can try again and see if it'll accept it later.

ProtocolVersion.v1_8),

params("viafabric.v1.7.2+v1.16.5;localhost", "localhost", null,
ProtocolVersion.v1_7_2, ProtocolVersion.v1_16_4),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 1.7.x actually work with ViaFabric? current build intentionally did not accept it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is out of scope for AddressParser to handle I think; I just picked random versions for test cases and rolled with it to make sure it parsed correctly.

Copy link
Member

@FlorianMichael FlorianMichael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might take a while for this to be reviewed but some things;

Generally author tags for parts of the code shouldn't be done as copyright is generally backed via the license header;

Changes to the address parser/format should be explained in the README.md file as well (to make sure users know about it).

@Ampflower
Copy link
Contributor Author

Ampflower commented Aug 23, 2024

Changes to the address parser/format should be explained in the README.md file as well (to make sure users know about it).

I'll write the prefix format down tomorrow, since I'm rather tired. I'm not going to write in the ability to pile up additional options tho, since that was more so mimicking the quirk of the original parser to make sure any existing invalid input in the wild would still work as expected. That can be changed easily tho if that isn't desired; i.e. just don't loop and instead bail after first iteration.

Copy link
Member

@Kichura Kichura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suffix/prefix readme looks good to me.

@Kichura
Copy link
Member

Kichura commented Sep 8, 2024

Decided to test the suffix and it seems to work fine on my end as far as i'm aware.

@Kichura
Copy link
Member

Kichura commented Nov 3, 2024

This PR has conflicts present, Please attempt to resolve them if you wish to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.viafabric suffix isn't working?
3 participants