权限模型
🌐 Permission model
在使用 权限模型 时,必须传递 --allow-net 标志以允许 QUIC 网络操作。如果不传递,调用 quic.connect() 或 quic.listen() 将抛出 ERR_ACCESS_DENIED 错误。
🌐 When using the Permission Model, the --allow-net flag must be passed to
allow QUIC network operations. Without it, calling quic.connect() or
quic.listen() will throw an ERR_ACCESS_DENIED error.
$ node --permission --allow-fs-read=* --experimental-quic index.mjs
Error: Access to this API has been restricted. Use --allow-net to manage permissions.
code: 'ERR_ACCESS_DENIED',
permission: 'Net',
} 即使没有 --allow-net,也允许创建一个 QuicEndpoint 实例而不进行连接或监听,因为在调用 quic.connect() 或 quic.listen() 之前不会发生任何网络 I/O。
🌐 Creating a QuicEndpoint instance without connecting or listening
is permitted even without --allow-net, since no network I/O occurs until
quic.connect() or quic.listen() is called.