Add new raknet library option (raknet-node) (#211)

* add new raknet library option (raknet-node)

* fix lint

* fix lint & add new options

* fix lint

* fix user option & add rust-raknet test.

* fix lint.

* add raknet backend option.

* remove useNativeRaknet option.

* add not found log.

* add test timeout size.

* fix js raknet return error.

* restore useNativeRaknet option.

* update doc.

* update options handling, back compat

* fix server doc

* Fix tests

* fix tests.

* fix lint.

* delay timeout.

* Update rak.js

* update raknet-node version.

* increase timeout.

* Update vanilla.js

* Update proxy.js

* Update internal.js

* update raknet-node version.

* update rust-raknet version.

* increase timeout test time

* increase timeout test time

* update backend version.

* change timeout

Co-authored-by: extremeheat <extreme@protonmail.ch>
This commit is contained in:
b23r0 2022-08-09 15:39:27 +08:00 committed by GitHub
commit b36c55e112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 52 additions and 42 deletions

View file

@ -1,7 +1,8 @@
const { createClient, createServer, Relay } = require('bedrock-protocol')
const { sleep, waitFor } = require('../src/datatypes/util')
function proxyTest (version, timeout = 1000 * 40) {
function proxyTest (version, raknetBackend = 'raknet-node', timeout = 1000 * 40) {
console.log('with raknet backend', raknetBackend)
return waitFor(res => {
const SERVER_PORT = 19000 + ((Math.random() * 100) | 0)
const CLIENT_PORT = 19000 + ((Math.random() * 100) | 0)
@ -9,6 +10,7 @@ function proxyTest (version, timeout = 1000 * 40) {
host: '0.0.0.0', // optional
port: SERVER_PORT, // optional
offline: true,
raknetBackend,
version // The server version
})
@ -34,14 +36,15 @@ function proxyTest (version, timeout = 1000 * 40) {
destination: {
host: '127.0.0.1',
port: SERVER_PORT
}
},
raknetBackend
})
relay.conLog = console.debug
relay.listen()
console.debug('Proxy started', server.options.version)
const client = createClient({ host: '127.0.0.1', port: CLIENT_PORT, version, username: 'Boat', offline: true })
const client = createClient({ host: '127.0.0.1', port: CLIENT_PORT, version, username: 'Boat', offline: true, raknetBackend })
console.debug('Client started')
@ -59,7 +62,7 @@ function proxyTest (version, timeout = 1000 * 40) {
}
if (!module.parent) {
proxyTest('1.16.220')
proxyTest('1.16.220', 'raknet-native')
}
module.exports = { proxyTest }

View file

@ -15,6 +15,7 @@ async function test (version) {
port: 19130,
username: 'Notch',
version,
raknetBackend: 'raknet-node',
offline: true
})