-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: bind torrent client to a network adapter #2405
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
Merged
+236
−3
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a48d497
feat: bind torrent client to a network adapter
Moyasee 550153d
feat: shorten network adapter setting hint
Moyasee e337b51
feat: add spacing below network adapter setting
Moyasee c2e3b66
feat: balance spacing around network adapter setting
Moyasee bdb94b1
refactor: address review feedback on network adapter binding
Moyasee 9959a13
Merge branch 'main' into feat/GH-2023
Hachi-R 2c2c992
fix: bind torrent client by resolved interface address
Moyasee a533c58
Merge branch 'main' into feat/GH-2023
Hachi-R 3efafd8
Merge branch 'main' into feat/GH-2023
Hachi-R File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import os from "node:os"; | ||
|
|
||
| import type { NetworkInterface } from "@types"; | ||
| import { registerEvent } from "../register-event"; | ||
|
|
||
| const getNetworkInterfaces = async (): Promise<NetworkInterface[]> => { | ||
| const interfaces = os.networkInterfaces(); | ||
|
|
||
| return Object.entries(interfaces).reduce<NetworkInterface[]>( | ||
| (acc, [name, addresses]) => { | ||
| const external = (addresses ?? []).filter((address) => !address.internal); | ||
|
|
||
| if (external.length === 0) { | ||
| return acc; | ||
| } | ||
|
|
||
| const sorted = external.sort((a, b) => { | ||
| if (a.family === b.family) return 0; | ||
| return a.family === "IPv4" ? -1 : 1; | ||
| }); | ||
|
|
||
| acc.push({ | ||
| name, | ||
| addresses: sorted.map((address) => address.address), | ||
| }); | ||
|
|
||
| return acc; | ||
| }, | ||
| [] | ||
| ); | ||
| }; | ||
|
|
||
| registerEvent("getNetworkInterfaces", getNetworkInterfaces); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| import "./check-folder-write-permission"; | ||
| import "./get-disk-free-space"; | ||
| import "./get-network-interfaces"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.