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

Network Settings Objects Generation #153

Merged
merged 1 commit into from
Oct 14, 2023
Merged

Network Settings Objects Generation #153

merged 1 commit into from
Oct 14, 2023

Conversation

JettChenT
Copy link
Member

@JettChenT JettChenT commented Sep 30, 2023

#53

This PR does the following:

  • implements domain socket, json-rpc based communication between swift frontend and rust backend
  • switches to anyhow for burrow crate
  • adds support for starting daemons on macos

@JettChenT JettChenT force-pushed the apple-ns branch 3 times, most recently from 4c25da1 to 01960af Compare October 1, 2023 03:55
@JettChenT JettChenT enabled auto-merge (rebase) October 1, 2023 04:02
@karamassie
Copy link

@JettChenT can you have a look at this and why the rust /win build is failing?

Copy link
Collaborator

@conradev conradev left a comment

Choose a reason for hiding this comment

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

This is awesome. It even comes with tests!!

This represents a huge amount of work, spanning a lot of different components and it is extremely well done. I left a few minor comments, but let's get this merged!

Apple/NetworkExtension/BurrowIpc.swift Outdated Show resolved Hide resolved
Apple/NetworkExtension/BurrowIpc.swift Outdated Show resolved Hide resolved
return try JSONDecoder().decode(Response<U>.self, from: data).result
}
func send_raw(_ request: Data) async throws -> Data {
try await withCheckedThrowingContinuation { continuation in
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should move the continuation to an extension so that we can keep BurrowIpc more readable

Copy link
Member Author

@JettChenT JettChenT Oct 7, 2023

Choose a reason for hiding this comment

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

Agreed!
As I understand it, should we move the continuations inside BurrowIpc as functions to extension NWConnection? Moving the continuations into an extension of BurrowIpc itself might require moving all the functions that depend on it into the extension.

Apple/NetworkExtension/DataTypes.swift Show resolved Hide resolved
Apple/NetworkExtension/NetworkExtension-macOS.entitlements Outdated Show resolved Hide resolved
guard let addr = cfig.address else {
return nil
}
let nst = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: addr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

addr should go in NEPacketTunnelNetworkSettings.ipv4Settings.addresses instead

tunnelRemoteAddress is intended to be the IP address of the server

Copy link
Member Author

Choose a reason for hiding this comment

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

I see! Currently I've updated this part to:

var nst = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "1.1.1.1")
nst.ipv4Settings = NEIPv4Settings(addresses: [addr], subnetMasks: ["0.0.0.0"])

Seeing that we will be handling the network interface after its initialization on the daemon side, I suppose the tunnelRemoteAddress field of this would not influence any behavior of the program? The program will error when no tunnelRemoteAddress is specified, so I put a makeshift 1.1.1.1 there.

Also, I'm wondering if we should also send the TunInterface.netmask() information to the frontend for ipv4Settings initialization.

auto-merge was automatically disabled October 12, 2023 13:58

Rebase failed

@JettChenT JettChenT force-pushed the apple-ns branch 2 times, most recently from bd21d8c to 8f6e0fa Compare October 14, 2023 17:07
This generates and applies NetworkSettings object with unix socket IPC.

- domain socket, json-rpc based communication
- switches to anyhow for burrow crate
- adds support for starting daemons on macos
@conradev conradev enabled auto-merge (rebase) October 14, 2023 17:21
@conradev conradev merged commit c9f104e into main Oct 14, 2023
10 checks passed
@conradev conradev deleted the apple-ns branch October 14, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants