View Source GRPC.Client.Resolver.Unix (grpc v0.11.3)

Resolver for gRPC clients connecting via Unix Domain Sockets (UDS).

This resolver handles target strings using the unix URI scheme, which allows a gRPC client to connect to a server via a Unix socket path. Unix domain sockets are supported on Unix systems only.

Target format

unix:///absolute/path/to/socket
  • The scheme must be unix.
  • The path must be absolute (/var/run/my.sock).
  • The port is not used in Unix sockets; :port will be nil.
  • The socket type is indicated via :socket => :unix.

Example

target = "unix:///var/run/my_grpc.sock"

{:ok, %{addresses: addresses, service_config: nil}} =
  GRPC.Client.Resolver.Unix.resolve(target)

addresses
# => [%{address: "/var/run/my_grpc.sock", port: nil, socket: :unix}]

This resolver always returns nil for the service config, as Unix sockets do not provide DNS TXT records or xDS configuration.

See the gRPC naming documentation for more information on URI-based resolution: https://github.com/grpc/grpc/blob/master/doc/naming.md