Some checks failed
codecov / upload (push) Failing after 13m59s
CodeQL / Analyze (push) Failing after 1s
Testing / vet-proto (push) Failing after 1s
Testing / tests (arm, latest) (push) Waiting to run
Testing / extras (latest) (push) Failing after 1s
Testing / static checks (latest-1) (push) Failing after 1s
Testing / tests (-race, latest) (push) Failing after 1s
Testing / tests (i386, latest) (push) Failing after 1s
Testing / tests (latest) (push) Failing after 1s
Testing / tests (latest-1) (push) Failing after 1s
Lock Threads / lock (push) Failing after 1s
govulncheck / govulncheck (.) (push) Failing after 1s
govulncheck / govulncheck (./cmd/protoc-gen-go-grpc) (push) Failing after 1s
govulncheck / govulncheck (./gcp/observability) (push) Failing after 1s
govulncheck / govulncheck (./security/advancedtls) (push) Failing after 1s
govulncheck / govulncheck (./stats/opencensus) (push) Failing after 1s
Stale bot / stale (push) Failing after 1s
30 lines
863 B
Markdown
30 lines
863 B
Markdown
# Unix abstract sockets
|
|
|
|
This examples shows how to start a gRPC server listening on a unix abstract
|
|
socket and how to get a gRPC client to connect to it.
|
|
|
|
## What is a unix abstract socket
|
|
|
|
An abstract socket address is distinguished from a regular unix socket by the
|
|
fact that the first byte of the address is a null byte ('\0'). The address has
|
|
no connection with filesystem path names.
|
|
|
|
## Try it
|
|
|
|
```
|
|
go run server/main.go
|
|
```
|
|
|
|
```
|
|
go run client/main.go
|
|
```
|
|
|
|
## Explanation
|
|
|
|
The gRPC server in this example listens on an address starting with a null byte
|
|
and the network is `unix`. The client uses the `unix-abstract` scheme with the
|
|
endpoint set to the abstract unix socket address without the null byte. The
|
|
`unix` resolver takes care of adding the null byte on the client. See
|
|
https://github.com/grpc/grpc/blob/master/doc/naming.md for the more details.
|
|
|