Unix Domain Socket doesn't support on Windows
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
20.18.0
Platform
Microsoft Windows NT 10.0.26100.0 x64
Subsystem
No response
What steps will reproduce the bug?
Currently, Windows (at least .NET) supports connect to UnixDomainSocket, or listen to UnixDomainSocket in ASP.NET Core. But node's net module seems not support connect to a Windows local file.
public class UnixDomainSocketsConnectionFactory(EndPoint endPoint) {
public async ValueTask<Stream> ConnectAsync(SocketsHttpConnectionContext _,
CancellationToken cancellationToken = default) {
var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
try {
await socket.ConnectAsync(endPoint, cancellationToken).ConfigureAwait(false);
return new NetworkStream(socket, true);
} catch {
socket.Dispose();
throw;
}
}
public static GrpcChannel CreateChannel(string socketPath) {
var udsEndPoint = new UnixDomainSocketEndPoint(socketPath);
var connectionFactory = new UnixDomainSocketsConnectionFactory(udsEndPoint);
var socketsHttpHandler = new SocketsHttpHandler {
ConnectCallback = connectionFactory.ConnectAsync
};
return GrpcChannel.ForAddress("http://localhost", new GrpcChannelOptions {
HttpHandler = socketsHttpHandler
});
}
}
protected void Initialize(string token) {
var builder = WebApplication.CreateBuilder();
builder.WebHost.ConfigureKestrel(serverOptions => {
if (!Directory.Exists(MetaBoxStatic.UnixSocketPath)) {
Directory.CreateDirectory(MetaBoxStatic.UnixSocketPath);
}
var socketPath = Path.Combine(MetaBoxStatic.UnixSocketPath, $"MetaBox-{token}.tmp");
serverOptions.ListenUnixSocket(socketPath);
serverOptions.ConfigureEndpointDefaults(listenOptions => { listenOptions.Protocols = HttpProtocols.Http2; });
});
ConfigureBuilder(builder);
builder.Services.PostConfigureAll<HostOptions>(opts => opts.ShutdownTimeout = TimeSpan.FromSeconds(1));
WebApp = builder.Build();
ConfigureApp(WebApp);
}
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
The net connects to the "Windows" UnixDomainSocket as it could.
What do you see instead?
EACCESS / ENOENT
Additional information
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Behandlung von Unix-Domain-Sockets unter Windows im net-Modul von Node.js und reproduziere den Fehler mithilfe der bereitgestellten Windows- und .NET-Beispiele. Als erledigt gilt, wenn Node eine Verbindung zum Windows UnixDomainSocket herstellen und dort lauschen kann und die gemeldeten Fehler EACCESS und ENOENT behoben sind; füge die relevanten plattformspezifischen Tests hinzu oder führe sie aus, sofern verfügbar.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, nodejs
- Bereich
- networking, operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100