Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow binding to a socket address via server builder #1686

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions Sources/GRPC/ServerBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,23 @@ extension Server {
return Server.start(configuration: self.configuration)
}

public func bind(to socketAddress: SocketAddress) -> EventLoopFuture<Server> {
self.configuration.target = .socketAddress(socketAddress)
self.configuration.tlsConfiguration = self.maybeTLS
return Server.start(configuration: self.configuration)
}

public func bind(vsockAddress: VsockAddress) -> EventLoopFuture<Server> {
self.configuration.target = .vsockAddress(vsockAddress)
self.configuration.tlsConfiguration = self.maybeTLS
return Server.start(configuration: self.configuration)
}

public func bind(to target: BindTarget) -> EventLoopFuture<Server> {
self.configuration.target = target
self.configuration.tlsConfiguration = self.maybeTLS
return Server.start(configuration: self.configuration)
}
}
}

Expand Down