Skip to content

Commit 31f9209

Browse files
committed
Add docs
1 parent 19e5267 commit 31f9209

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

docs/en/client/configuration.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ If you prefer to read the sources instead, you can do so
3838
[here](https://github.com/yidongnan/grpc-spring-boot-starter/blob/master/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java#L58).
3939

4040
The properties for the channels are all prefixed with `grpc.client.__name__.` and `grpc.client.__name__.security.`
41-
respectively. The channel name is taken from the `@GrpcClient` annotation. If you wish to configure some options such as
42-
trusted certificates for all servers at once you can do so using `GLOBAL` as name. Properties that are defined for a
43-
name channel take precedence over global once.
41+
respectively. The channel name is taken from the `@GrpcClient("__name__")` annotation.
42+
If you wish to configure some options such as trusted certificates for all servers at once,
43+
you can do so using `GLOBAL` as name.
44+
Properties that are defined for a specific/named channel take precedence over `GLOBAL` ones.
4445

4546
### Choosing the Target
4647

@@ -55,6 +56,7 @@ There are a number of supported schemes, that you can use to determine the targe
5556

5657
- `static` (Prio 4): \
5758
A simple static list of IPs (both v4 and v6), that can be use connect to the server (Supports `localhost`). \
59+
For resolvable hostnames please use `dns` instead. \
5860
Example: `static://192.168.1.1:8080,10.0.0.1:1337`
5961
- [`dns`](https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/DnsNameResolver.java#L66)
6062
(Prio 5): \
@@ -77,6 +79,11 @@ There are a number of supported schemes, that you can use to determine the targe
7779
This is a special scheme that will bypass the normal channel factory and will use the `InProcessChannelFactory`
7880
instead. Use it to connect to the [`InProcessServer`](../server/configuration.md#enabling-the-inprocessserver). \
7981
Example: `in-process:foobar`
82+
- `unix` (Available on Unix based systems only): \
83+
This is a special scheme that uses unix's domain socket addresses to connect to a server. \
84+
If you are using `grpc-netty` you also need the `netty-transport-native-epoll` dependency.
85+
`grpc-netty-shaded` already contains that dependency, so there is no need to add anything for it to work. \
86+
Example: `unix:/run/grpc-server`
8087
- *custom*: \
8188
You can define custom
8289
[`NameResolverProvider`s](https://javadoc.io/page/io.grpc/grpc-all/latest/io/grpc/NameResolverProvider.html) those
@@ -267,6 +274,7 @@ you have to define it via spring context (unless you wish to use `static`).
267274
- [Getting Started](getting-started.md)
268275
- *Configuration*
269276
- [Security](security.md)
277+
- [Tests with Grpc-Stubs](testing.md)
270278

271279
----------
272280

docs/en/server/configuration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ grpc.client.inProcess.address=in-process:<SomeName>
7575
This is especially useful for tests as they don't need to open a specific port and thus can run concurrently (on a build
7676
server).
7777

78+
### Using Unix's Domain Sockets
79+
80+
On Unix based systems you can also use domain sockets to locally communicate between server and clients.
81+
82+
Simply configure the address like this:
83+
84+
````properties
85+
grpc.server.address=unix:/run/grpc-server
86+
````
87+
88+
Clients can then connect to the server using the same address.
89+
90+
If you are using `grpc-netty` you also need the `netty-transport-native-epoll` dependency.
91+
`grpc-netty-shaded` already contains that dependency, so there is no need to add anything for it to work.
92+
7893
## Configuration via Beans
7994

8095
While this library intents to provide most of the features as configuration option, sometimes the overhead for adding it

grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ public void setAddress(final URI address) {
104104
* <li>{@code dns:///example.com:9090}</li>
105105
* <li>{@code discovery:/foo-service}</li>
106106
* <li>{@code discovery:///foo-service}</li>
107+
* <li>{@code unix:<relative-path>} (Additional dependencies may be required)</li>
108+
* <li>{@code unix://</absolute-path>} (Additional dependencies may be required)</li>
107109
* </ul>
108110
*
109111
* @param address The string representation of an uri to use as target address or null to use a fallback.

grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/config/GrpcServerProperties.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
4040
import io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder;
4141
import lombok.Data;
42+
import net.devh.boot.grpc.common.util.GrpcUtils;
4243

4344
/**
4445
* The properties for the gRPC server that will be started as part of the application.
@@ -69,6 +70,8 @@ public class GrpcServerProperties {
6970
/**
7071
* Bind address for the server. Defaults to {@link #ANY_IP_ADDRESS "*"}. Alternatively you can restrict this to
7172
* {@link #ANY_IPv4_ADDRESS "0.0.0.0"} or {@link #ANY_IPv6_ADDRESS "::"}. Or restrict it to exactly one IP address.
73+
* On unix systems it is also possible to prefix it with {@link GrpcUtils#DOMAIN_SOCKET_ADDRESS_PREFIX unix:} to use
74+
* domain socket addresses/paths (Additional dependencies may be required).
7275
*
7376
* @param address The address to bind to.
7477
* @return The address the server should bind to.

0 commit comments

Comments
 (0)