-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(local): local-tun build on Windows
- Loading branch information
Showing
4 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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
20 changes: 20 additions & 0 deletions
20
crates/shadowsocks-service/src/local/tun/sys/windows/mod.rs
This file contains 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 +1,21 @@ | ||
use std::{io, marker::Unpin}; | ||
|
||
use tokio::io::{AsyncWrite, AsyncWriteExt}; | ||
use tun::platform::Device as TunDevice; | ||
|
||
/// Packet Information length in bytes | ||
/// | ||
/// Tun device on Windows (https://wintun.net) doesn't have Packet Information header, so there is no prefix headers | ||
pub const IFF_PI_PREFIX_LEN: usize = 0; | ||
|
||
/// Writing packet with packet information | ||
/// | ||
/// Tun device on Windows (https://wintun.net) doesn't have Packet Information header, so there is nothing to prepend on Windows | ||
pub async fn write_packet_with_pi<W: AsyncWrite + Unpin>(writer: &mut W, packet: &[u8]) -> io::Result<()> { | ||
writer.write_all(packet).await | ||
} | ||
|
||
/// Set platform specific route configuration | ||
pub async fn set_route_configuration(_device: &TunDevice) -> io::Result<()> { | ||
Ok(()) | ||
} |
This file contains 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