-
-
Notifications
You must be signed in to change notification settings - Fork 862
[client] Add wasm client #4415
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
base: main
Are you sure you want to change the base?
[client] Add wasm client #4415
Conversation
9614aca
to
2e1cd65
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds WebAssembly (WASM) client support to NetBird, enabling NetBird to run in browser environments. The implementation provides browser-compatible networking through WebSocket proxies and userspace networking.
- Platform-specific build configurations to enable/disable features based on WASM constraints
- WASM-specific networking implementations using WebSocket transport for gRPC and relay connections
- Browser-compatible SSH, RDP and HTTP proxy functionality for connecting to NetBird network resources
Reviewed Changes
Copilot reviewed 56 out of 58 changed files in this pull request and generated 13 comments.
Show a summary per file
File | Description |
---|---|
util/wsproxy/constants.go | Defines WebSocket proxy constants and error types |
util/wsproxy/client/dialer_js.go | WASM WebSocket dialer for gRPC connections |
util/grpc/dialer_*.go | Platform-specific gRPC dialers (WASM vs generic) |
client/wasm/* | WASM client implementation with SSH, RDP, HTTP proxy support |
client/embed/embed.go | Enhanced embedded client with JWT authentication |
Various platform-specific files | Build tag constraints to separate WASM from non-WASM implementations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -38,8 +38,7 @@ func (c *Conn) Read(b []byte) (n int, err error) { | |||
} | |||
|
|||
func (c *Conn) Write(b []byte) (n int, err error) { | |||
err = c.Conn.Write(c.ctx, websocket.MessageBinary, b) | |||
return 0, err | |||
return 0, c.Conn.Write(c.ctx, websocket.MessageBinary, b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function signature expects to return (int, error) but is returning (0, error). This doesn't indicate how many bytes were written. Should return len(b) on successful write.
return 0, c.Conn.Write(c.ctx, websocket.MessageBinary, b) | |
err = c.Conn.Write(c.ctx, websocket.MessageBinary, b) | |
if err != nil { | |
return 0, err | |
} | |
return len(b), nil |
Copilot uses AI. Check for mistakes.
|
Describe your changes
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__