Skip to content

Nethernet support for joining worlds #533

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

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

LucienHH
Copy link
Contributor

@LucienHH LucienHH commented Oct 4, 2024

Majority work for Nethernet support. Supports listening and joining over LAN, signalling via the franchise WebSocket and creating/joining an Xbox session.

To do

Closes #473

Copy link

socket-security bot commented Oct 4, 2024

Review the following changes in direct dependencies. Learn more about Socket for GitHub ↗.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedxbox-rta@​2.1.0721009978100
Addedjson-bigint@​1.0.010010010076100
Addedws@​8.18.19910010090100

View full report ↗

@extremeheat
Copy link
Member

Thanks for working on this, please advise when it's ready for review

@LucienHH
Copy link
Contributor Author

LucienHH commented Oct 7, 2024

Most the work is done apart from some bits but would probably be good to start moving parts of this out of here into other areas. Mainly moving the contents of ./nethernet, I'd think it'd make sense to have this in a prismarine-nethernet repo maybe?

Same with the Xbox Session API, I think we could get away with putting this in pauth unless you think we should separate an Xbox API to another repo?

Comment on lines 17 to 21
const PORT = 7551
const BROADCAST_ADDRESS = getBroadcastAddress()
Copy link
Member

Choose a reason for hiding this comment

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

Where are these constants coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Port 7551 is used for Nethernet LAN discovery and a network discovery request is sent to the broadcast address


client.conLog?.(`Connecting to ${client.options.host}:${client.options.port} ${ad.motd} (${ad.levelName}), version ${ad.version} ${client.options.version !== ad.version ? ` (as ${client.options.version})` : ''}`)
} else if (client.options.transport === 'nethernet') {
client.conLog?.(`Connecting to ${client.options.networkId} ${ad.motd} (${ad.levelName})`)
Copy link
Member

Choose a reason for hiding this comment

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

How do we know what version to connect as here if the user does not specify/can't get via ping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the user doesn't specify it defaults to the current version and the version isn't included in the Nethernet ping response

Copy link
Member

Choose a reason for hiding this comment

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

OK, what is advertisement.version then? We may have to figure out the version after connecting to the server then like nmp can do. It should be sent in login/network_settings packet otherwise. The current code should also be matching version by protocol version num over strings but that should be fixed outside this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not entirely sure but I assume it's the version of NetherNet protocol being used as it's just a uint8. From my testing it's always been set to 3 over multiple version updates.

Copy link
Member

@extremeheat extremeheat left a comment

Choose a reason for hiding this comment

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

node-fetch can be removed in favor of native fetch now that it's also removed from prismarine-auth

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.

Allow bots to join friend worlds.
2 participants