Unix Domain Socket doesn't support on Windows
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 122k
- Forks
- 37.3k
- Merge moyen
- 4 j 2 h
- PR mergées (30 j)
- 283
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le traitement des sockets de domaine Unix sous Windows par le module net de Node.js et reproduisez l’échec à l’aide des exemples Windows et .NET fournis. Le travail sera considéré comme terminé lorsque Node pourra se connecter au Windows UnixDomainSocket et y écouter, et que les erreurs signalées EACCESS et ENOENT seront résolues ; ajoutez ou exécutez les tests pertinents spécifiques à la plateforme s’ils sont disponibles.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, nodejs
- Domaine
- networking, operating-systems
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100