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

credentials/alts: Support UDS addresses in ALTS interop test server #2763

Merged
merged 4 commits into from
Apr 11, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion interop/alts/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package main
import (
"flag"
"net"
"strings"

grpc "google.golang.org/grpc"
"google.golang.org/grpc/credentials/alts"
Expand All @@ -30,6 +31,10 @@ import (
testpb "google.golang.org/grpc/interop/grpc_testing"
)

const (
udsAddrPrefix = "unix:"
)

var (
hsAddr = flag.String("alts_handshaker_service_address", "", "ALTS handshaker gRPC service address")
serverAddr = flag.String("server_address", ":8080", "The port on which the server is listening")
cesarghali marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -38,7 +43,12 @@ var (
func main() {
flag.Parse()

lis, err := net.Listen("tcp", *serverAddr)
// If the server address starts with `unix:`, then we have a UDS address.
network := "tcp"
if strings.HasPrefix(*serverAddr, udsAddrPrefix) {
network = "unix"
}
lis, err := net.Listen(network, *serverAddr)
cesarghali marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
grpclog.Fatalf("gRPC Server: failed to start the server at %v: %v", *serverAddr, err)
}
Expand Down