Squashed commit of the following:

commit 0af98df2e4d41989c451573a17e81c1f69998cfd
Author: Boshi Lian <farmer1992@gmail.com>
Date:   Sun Oct 3 18:55:59 2021 +0000

    add a working remote grpc server

commit a0acce4894fc9191ddb4c14f5cc669bca63bd920
Author: Boshi Lian <farmer1992@gmail.com>
Date:   Tue Sep 28 11:33:40 2021 +0000

    init grpc
This commit is contained in:
Boshi Lian 2021-10-03 19:30:22 +00:00
parent ff48ef7768
commit e6d5eb54d9
14 changed files with 1147 additions and 4 deletions

View file

@ -1,4 +1,4 @@
FROM golang:1.15-alpine as builder
FROM golang:1.17-alpine as builder
RUN apk update \
&& apk upgrade \

35
go.mod
View file

@ -1,6 +1,6 @@
module github.com/tg123/sshpiper
go 1.15
go 1.17
replace (
github.com/jessevdk/go-flags => github.com/tg123/go-flags v1.4.0-globalref
@ -30,15 +30,48 @@ require (
github.com/msteinert/pam v0.0.0-20190215180659-f29b9f28d6f9
github.com/pockost/sshpipe-k8s-lib v0.0.3
github.com/stretchr/testify v1.7.0 // indirect
github.com/tg123/remotesigner v0.0.0-20210928104451-7c20285909d1
github.com/tg123/sshkey v0.0.0-20201202190454-3bb356f89f1f
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc v1.40.0
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
k8s.io/apimachinery v0.21.1
k8s.io/client-go v0.21.1
k8s.io/utils v0.0.0-20210527160623-6fdb442a123b // indirect
)
require (
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.0 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.21.1 // indirect
k8s.io/klog/v2 v2.8.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
replace k8s.io/client-go => k8s.io/client-go v0.21.1

30
go.sum
View file

@ -51,18 +51,24 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@ -76,7 +82,11 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
@ -84,6 +94,7 @@ github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@ -129,6 +140,7 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
@ -163,6 +175,7 @@ github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9
github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
@ -224,7 +237,9 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/pockost/sshpipe-k8s-lib v0.0.3 h1:ODL5EFZyoAE7jMoDDawub4UpQ1DTUFp6w9puCA5K6mY=
github.com/pockost/sshpipe-k8s-lib v0.0.3/go.mod h1:gDUHQhvnDsuvrIVuVD6HCaFYEZ1iXZ0aeXV1e+T1qi8=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
@ -240,6 +255,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tg123/go-flags v1.4.0-globalref h1:pfUF3Mdnw5gZ5izA7s95Yrp+AetZPlnO9x39RByCi98=
github.com/tg123/go-flags v1.4.0-globalref/go.mod h1:G60U6XrJAj49cFQ8MY2Wr+SEjylerbSqj0I8FZy2tFE=
github.com/tg123/remotesigner v0.0.0-20210928104451-7c20285909d1 h1:17rr5yKlOnsxUxRH8sD9SEvJuPJIIsSZa6XVeMmkV7E=
github.com/tg123/remotesigner v0.0.0-20210928104451-7c20285909d1/go.mod h1:leliuGRH9ayYYwRo6JO8yg+KyWcltK69XJdLv1x7slM=
github.com/tg123/sshkey v0.0.0-20201202190454-3bb356f89f1f h1:MOxh2uC27wne9vo2OJqtL2W0Uq3qbBnaOGKgiJA+/fI=
github.com/tg123/sshkey v0.0.0-20201202190454-3bb356f89f1f/go.mod h1:0NrddipH8l+ho+Cpbs4qrpEaqbNeHUAfhxURhKC1waE=
github.com/tg123/sshpiper.crypto v0.0.0-sshpiper-20201202 h1:a2r3NdQN25cm02epOv0tfimKWNfaR4apxMk0UAIRh2E=
@ -250,6 +267,7 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -302,6 +320,7 @@ golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
@ -437,15 +456,22 @@ google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 h1:bFFRpT+e8JJVY7lMMfvezL1ZIwqiwmPl2bsE2yx4HqM=
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@ -457,8 +483,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@ -471,6 +498,7 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

View file

@ -5,6 +5,7 @@ import (
_ "github.com/tg123/sshpiper/sshpiperd/upstream/kubernetes"
_ "github.com/tg123/sshpiper/sshpiperd/upstream/workingdir"
_ "github.com/tg123/sshpiper/sshpiperd/upstream/yaml"
_ "github.com/tg123/sshpiper/sshpiperd/upstream/grpcupstream"
_ "github.com/tg123/sshpiper/sshpiperd/challenger/authy"
_ "github.com/tg123/sshpiper/sshpiperd/challenger/azdevicecode"

View file

@ -0,0 +1,92 @@
package grpcupstream
import (
"context"
"net"
"github.com/tg123/remotesigner"
"github.com/tg123/remotesigner/grpcsigner"
"github.com/tg123/sshpiper/sshpiperd/upstream"
"golang.org/x/crypto/ssh"
)
func (p *plugin) mapauth(conn ssh.ConnMetadata, metadata string, typ MapAuthRequest_Authtype, param []byte) (ssh.AuthPipeType, ssh.AuthMethod, error) {
// TODO timeout
a, err := p.upstreamClient.MapAuth(context.TODO(), &MapAuthRequest{
UserName: conn.User(),
FromAddr: conn.RemoteAddr().String(),
AuthType: typ,
AuthParam: param,
Metadata: metadata,
})
if err != nil {
return ssh.AuthPipeTypeDiscard, nil, err
}
switch a.MappedAuthType {
case MapAuthReply_PASSTHROUGH:
return ssh.AuthPipeTypePassThrough, nil, nil
case MapAuthReply_DISCARD:
return ssh.AuthPipeTypeDiscard, nil, nil
case MapAuthReply_NONE:
return ssh.AuthPipeTypeNone, nil, nil
case MapAuthReply_PASSWORD:
return ssh.AuthPipeTypeMap, ssh.Password(string(a.MappedAuthParam)), nil
case MapAuthReply_PRIVATEKEY:
private, err := ssh.ParsePrivateKey(a.MappedAuthParam)
if err != nil {
return ssh.AuthPipeTypeDiscard, nil, err
}
return ssh.AuthPipeTypeMap, ssh.PublicKeys(private), nil
case MapAuthReply_REMOTESIGNER:
rs := remotesigner.New(grpcsigner.New(p.remotesignerClient, string(a.MappedAuthParam)))
signer, err := ssh.NewSignerFromSigner(rs)
if err != nil {
return ssh.AuthPipeTypeDiscard, nil, err
}
return ssh.AuthPipeTypeMap, ssh.PublicKeys(signer), nil
default:
return ssh.AuthPipeTypeDiscard, nil, nil
}
}
func (p *plugin) findUpstream(conn ssh.ConnMetadata, challengeContext ssh.AdditionalChallengeContext) (net.Conn, *ssh.AuthPipe, error) {
// TODO timeout to config
u, err := p.upstreamClient.FindUpstream(context.TODO(), &FindUpstreamRequest{
UserName: conn.User(),
FromAddr: conn.RemoteAddr().String(),
})
if err != nil {
return nil, nil, err
}
c, err := upstream.DialForSSH(u.ToAddr)
if err != nil {
return nil, nil, err
}
a := &ssh.AuthPipe{
User: u.MappedUserName,
UpstreamHostKeyCallback: ssh.InsecureIgnoreHostKey(), // TODO replace with gRPC api
}
a.NoneAuthCallback = func(conn ssh.ConnMetadata) (ssh.AuthPipeType, ssh.AuthMethod, error) {
return p.mapauth(conn, u.Metadata, MapAuthRequest_NONE, nil)
}
a.PasswordCallback = func(conn ssh.ConnMetadata, password []byte) (ssh.AuthPipeType, ssh.AuthMethod, error) {
return p.mapauth(conn, u.Metadata, MapAuthRequest_PASSWORD, password)
}
a.PublicKeyCallback = func(conn ssh.ConnMetadata, key ssh.PublicKey) (ssh.AuthPipeType, ssh.AuthMethod, error) {
return p.mapauth(conn, u.Metadata, MapAuthRequest_PUBLICKEY, key.Marshal())
}
return c, a, nil
}

View file

@ -0,0 +1,20 @@
package grpcupstream
import (
"github.com/tg123/sshpiper/sshpiperd/upstream"
)
// Return All pipes inside upstream
func (p *plugin) ListPipe() ([]upstream.Pipe, error) {
return nil, nil
}
// Create a pipe inside upstream
func (p *plugin) CreatePipe(opt upstream.CreatePipeOption) error {
return nil
}
// Remove a pipe from upstream
func (p *plugin) RemovePipe(name string) error {
return nil
}

View file

@ -0,0 +1,89 @@
package grpcupstream
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"github.com/tg123/remotesigner/grpcsigner"
"github.com/tg123/sshpiper/sshpiperd/upstream"
grpc "google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)
type plugin struct {
Config struct {
Endpoint string `long:"upstream-grpc-endpoint" description:"grpc endpoint of the upstream" env:"SSHPIPERD_UPSTREAM_GRPC_ENDPOINT" ini-name:"upstream-grpc-endpoint"`
Insecure bool `long:"upstream-grpc-insecure" description:"disable secure grpc connection" env:"SSHPIPERD_UPSTREAM_GRPC_INSECURE" ini-name:"upstream-grpc-insecure"`
CA string `long:"upstream-grpc-ca" description:"ca file path" env:"SSHPIPERD_UPSTREAM_GRPC_CA" ini-name:"upstream-grpc-ca"`
Cert string `long:"upstream-grpc-cert" description:"certificate file path" env:"SSHPIPERD_UPSTREAM_GRPC_CERT" ini-name:"upstream-grpc-cert"`
Key string `long:"upstream-grpc-key" description:"key file path" env:"SSHPIPERD_UPSTREAM_GRPC_KEY" ini-name:"upstream-grpc-key"`
}
logger *log.Logger
upstreamClient UpstreamRegistryClient
remotesignerClient grpcsigner.SignerClient
}
// The name of the Plugin
func (p *plugin) GetName() string {
return "grpc"
}
func (p *plugin) GetOpts() interface{} {
return &p.Config
}
func (p *plugin) Init(logger *log.Logger) error {
p.logger = logger
var secopt grpc.DialOption
if p.Config.Insecure {
secopt = grpc.WithInsecure()
} else {
clientCert, err := tls.LoadX509KeyPair(p.Config.Cert, p.Config.Key)
if err != nil {
return err
}
config := &tls.Config{
Certificates: []tls.Certificate{clientCert},
}
if p.Config.CA != "" {
ca, err := ioutil.ReadFile(p.Config.CA)
if err != nil {
return err
}
certPool := x509.NewCertPool()
if !certPool.AppendCertsFromPEM(ca) {
return fmt.Errorf("failed to append ca")
}
config.RootCAs = certPool
}
secopt = grpc.WithTransportCredentials(credentials.NewTLS(config))
}
conn, err := grpc.Dial(p.Config.Endpoint, secopt, grpc.WithBlock())
if err != nil {
return err
}
p.upstreamClient = NewUpstreamRegistryClient(conn)
p.remotesignerClient = grpcsigner.NewSignerClient(conn)
return nil
}
func (p *plugin) GetHandler() upstream.Handler {
return p.findUpstream
}
func init() {
upstream.Register("grpc", &plugin{})
}

View file

@ -0,0 +1,67 @@
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"github.com/tg123/remotesigner/grpcsigner"
"github.com/tg123/sshpiper/sshpiperd/upstream/grpcupstream"
)
type server struct {
grpcupstream.UnimplementedUpstreamRegistryServer
grpcsigner.UnimplementedSignerServer
ToType string `long:"totype" default:"PASSTHROUGH"`
ToAddr string `long:"toaddr"`
MappedUserName string `long:"mappeduser"`
Password string `long:"password"`
PrivateKey string `long:"privatekey"`
}
func (s *server) FindUpstream(_ context.Context, request *grpcupstream.FindUpstreamRequest) (*grpcupstream.FindUpstreamReply, error) {
log.Printf("mapping [%v@%v] to [%v@%v]", request.UserName, request.FromAddr, s.MappedUserName, s.ToAddr)
return &grpcupstream.FindUpstreamReply{
ToAddr: s.ToAddr,
MappedUserName: s.MappedUserName,
}, nil
}
func (s *server) MapAuth(_ context.Context, request *grpcupstream.MapAuthRequest) (*grpcupstream.MapAuthReply, error) {
totype := grpcupstream.MapAuthReply_Authtype(grpcupstream.MapAuthReply_Authtype_value[s.ToType])
log.Printf("mapping auth [%v] to [%v]", request.AuthType, totype)
// add your own auth here
switch totype {
case grpcupstream.MapAuthReply_PASSTHROUGH, grpcupstream.MapAuthReply_DISCARD, grpcupstream.MapAuthReply_NONE:
return &grpcupstream.MapAuthReply{
MappedAuthType: totype,
}, nil
case grpcupstream.MapAuthReply_PASSWORD:
return &grpcupstream.MapAuthReply{
MappedAuthType: grpcupstream.MapAuthReply_PASSWORD,
MappedAuthParam: []byte(s.Password),
}, nil
case grpcupstream.MapAuthReply_PRIVATEKEY:
b, err := ioutil.ReadFile(s.PrivateKey)
if err != nil {
return nil, err
}
return &grpcupstream.MapAuthReply{
MappedAuthType: grpcupstream.MapAuthReply_PRIVATEKEY,
MappedAuthParam: b,
}, nil
case grpcupstream.MapAuthReply_REMOTESIGNER:
return &grpcupstream.MapAuthReply{
MappedAuthType: grpcupstream.MapAuthReply_REMOTESIGNER,
MappedAuthParam: []byte(s.PrivateKey),
}, nil
}
return nil, fmt.Errorf("unsupported to type")
}

View file

@ -0,0 +1,72 @@
package main
import (
"crypto"
"fmt"
"io/ioutil"
"log"
"net"
"reflect"
"unsafe"
"github.com/jessevdk/go-flags"
"github.com/tg123/remotesigner/grpcsigner"
"github.com/tg123/sshpiper/sshpiperd/upstream/grpcupstream"
"golang.org/x/crypto/ssh"
"google.golang.org/grpc"
)
type args struct {
ListenAddr string `short:"l" long:"listen" default:"127.0.0.1"`
Port uint `short:"p" long:"port" default:"2233"`
server
}
func main() {
var c args
if _, err := flags.Parse(&c); err != nil {
log.Fatalf("parse args %v", err)
}
addr := fmt.Sprintf("%v:%v", c.ListenAddr, c.Port)
l, err := net.Listen("tcp", addr)
if err != nil {
log.Fatalf("listen on %v failed %v", addr, err)
}
if _, ok := grpcupstream.MapAuthReply_Authtype_value[c.ToType]; !ok {
log.Fatalf("totype [%v] not allowed", c.ToType)
}
s := grpc.NewServer()
grpcupstream.RegisterUpstreamRegistryServer(s, &c.server)
if c.PrivateKey != "" {
b, err := ioutil.ReadFile(c.PrivateKey)
if err != nil {
log.Fatalf("private key [%v] load failed %v", c.PrivateKey, err)
}
private, err := ssh.ParsePrivateKey(b)
if err != nil {
log.Fatalf("private key [%v] parse failed %v", c.PrivateKey, err)
}
field := reflect.ValueOf(private).Elem().FieldByName("signer")
signer := reflect.NewAt(field.Type(), unsafe.Pointer(field.UnsafeAddr())).Elem().Interface().(crypto.Signer)
gs, err := grpcsigner.NewSignerServer(func(string) crypto.Signer {
log.Printf("remote signing with %v", c.PrivateKey)
return signer
})
if err != nil {
log.Fatalf("start grpc signer failed %v", err)
}
grpcsigner.RegisterSignerServer(s, gs)
}
log.Printf("serving on %v", addr)
s.Serve(l)
}

Binary file not shown.

View file

@ -0,0 +1,557 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.14.0
// source: upstream.proto
package grpcupstream
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type MapAuthRequest_Authtype int32
const (
MapAuthRequest_NONE MapAuthRequest_Authtype = 0
MapAuthRequest_PASSWORD MapAuthRequest_Authtype = 1
MapAuthRequest_PUBLICKEY MapAuthRequest_Authtype = 2
)
// Enum value maps for MapAuthRequest_Authtype.
var (
MapAuthRequest_Authtype_name = map[int32]string{
0: "NONE",
1: "PASSWORD",
2: "PUBLICKEY",
}
MapAuthRequest_Authtype_value = map[string]int32{
"NONE": 0,
"PASSWORD": 1,
"PUBLICKEY": 2,
}
)
func (x MapAuthRequest_Authtype) Enum() *MapAuthRequest_Authtype {
p := new(MapAuthRequest_Authtype)
*p = x
return p
}
func (x MapAuthRequest_Authtype) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (MapAuthRequest_Authtype) Descriptor() protoreflect.EnumDescriptor {
return file_upstream_proto_enumTypes[0].Descriptor()
}
func (MapAuthRequest_Authtype) Type() protoreflect.EnumType {
return &file_upstream_proto_enumTypes[0]
}
func (x MapAuthRequest_Authtype) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use MapAuthRequest_Authtype.Descriptor instead.
func (MapAuthRequest_Authtype) EnumDescriptor() ([]byte, []int) {
return file_upstream_proto_rawDescGZIP(), []int{2, 0}
}
type MapAuthReply_Authtype int32
const (
MapAuthReply_PASSTHROUGH MapAuthReply_Authtype = 0
MapAuthReply_DISCARD MapAuthReply_Authtype = 1
MapAuthReply_NONE MapAuthReply_Authtype = 2
MapAuthReply_PASSWORD MapAuthReply_Authtype = 3
MapAuthReply_PRIVATEKEY MapAuthReply_Authtype = 4
MapAuthReply_REMOTESIGNER MapAuthReply_Authtype = 5
)
// Enum value maps for MapAuthReply_Authtype.
var (
MapAuthReply_Authtype_name = map[int32]string{
0: "PASSTHROUGH",
1: "DISCARD",
2: "NONE",
3: "PASSWORD",
4: "PRIVATEKEY",
5: "REMOTESIGNER",
}
MapAuthReply_Authtype_value = map[string]int32{
"PASSTHROUGH": 0,
"DISCARD": 1,
"NONE": 2,
"PASSWORD": 3,
"PRIVATEKEY": 4,
"REMOTESIGNER": 5,
}
)
func (x MapAuthReply_Authtype) Enum() *MapAuthReply_Authtype {
p := new(MapAuthReply_Authtype)
*p = x
return p
}
func (x MapAuthReply_Authtype) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (MapAuthReply_Authtype) Descriptor() protoreflect.EnumDescriptor {
return file_upstream_proto_enumTypes[1].Descriptor()
}
func (MapAuthReply_Authtype) Type() protoreflect.EnumType {
return &file_upstream_proto_enumTypes[1]
}
func (x MapAuthReply_Authtype) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use MapAuthReply_Authtype.Descriptor instead.
func (MapAuthReply_Authtype) EnumDescriptor() ([]byte, []int) {
return file_upstream_proto_rawDescGZIP(), []int{3, 0}
}
type FindUpstreamRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserName string `protobuf:"bytes,1,opt,name=userName,proto3" json:"userName,omitempty"`
FromAddr string `protobuf:"bytes,2,opt,name=fromAddr,proto3" json:"fromAddr,omitempty"`
}
func (x *FindUpstreamRequest) Reset() {
*x = FindUpstreamRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_upstream_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindUpstreamRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindUpstreamRequest) ProtoMessage() {}
func (x *FindUpstreamRequest) ProtoReflect() protoreflect.Message {
mi := &file_upstream_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FindUpstreamRequest.ProtoReflect.Descriptor instead.
func (*FindUpstreamRequest) Descriptor() ([]byte, []int) {
return file_upstream_proto_rawDescGZIP(), []int{0}
}
func (x *FindUpstreamRequest) GetUserName() string {
if x != nil {
return x.UserName
}
return ""
}
func (x *FindUpstreamRequest) GetFromAddr() string {
if x != nil {
return x.FromAddr
}
return ""
}
type FindUpstreamReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ToAddr string `protobuf:"bytes,1,opt,name=toAddr,proto3" json:"toAddr,omitempty"`
MappedUserName string `protobuf:"bytes,2,opt,name=mappedUserName,proto3" json:"mappedUserName,omitempty"`
Metadata string `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (x *FindUpstreamReply) Reset() {
*x = FindUpstreamReply{}
if protoimpl.UnsafeEnabled {
mi := &file_upstream_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindUpstreamReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindUpstreamReply) ProtoMessage() {}
func (x *FindUpstreamReply) ProtoReflect() protoreflect.Message {
mi := &file_upstream_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FindUpstreamReply.ProtoReflect.Descriptor instead.
func (*FindUpstreamReply) Descriptor() ([]byte, []int) {
return file_upstream_proto_rawDescGZIP(), []int{1}
}
func (x *FindUpstreamReply) GetToAddr() string {
if x != nil {
return x.ToAddr
}
return ""
}
func (x *FindUpstreamReply) GetMappedUserName() string {
if x != nil {
return x.MappedUserName
}
return ""
}
func (x *FindUpstreamReply) GetMetadata() string {
if x != nil {
return x.Metadata
}
return ""
}
type MapAuthRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserName string `protobuf:"bytes,1,opt,name=userName,proto3" json:"userName,omitempty"`
FromAddr string `protobuf:"bytes,2,opt,name=fromAddr,proto3" json:"fromAddr,omitempty"`
Metadata string `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"`
AuthType MapAuthRequest_Authtype `protobuf:"varint,4,opt,name=authType,proto3,enum=grpcupstream.MapAuthRequest_Authtype" json:"authType,omitempty"`
AuthParam []byte `protobuf:"bytes,5,opt,name=authParam,proto3" json:"authParam,omitempty"`
}
func (x *MapAuthRequest) Reset() {
*x = MapAuthRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_upstream_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MapAuthRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MapAuthRequest) ProtoMessage() {}
func (x *MapAuthRequest) ProtoReflect() protoreflect.Message {
mi := &file_upstream_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MapAuthRequest.ProtoReflect.Descriptor instead.
func (*MapAuthRequest) Descriptor() ([]byte, []int) {
return file_upstream_proto_rawDescGZIP(), []int{2}
}
func (x *MapAuthRequest) GetUserName() string {
if x != nil {
return x.UserName
}
return ""
}
func (x *MapAuthRequest) GetFromAddr() string {
if x != nil {
return x.FromAddr
}
return ""
}
func (x *MapAuthRequest) GetMetadata() string {
if x != nil {
return x.Metadata
}
return ""
}
func (x *MapAuthRequest) GetAuthType() MapAuthRequest_Authtype {
if x != nil {
return x.AuthType
}
return MapAuthRequest_NONE
}
func (x *MapAuthRequest) GetAuthParam() []byte {
if x != nil {
return x.AuthParam
}
return nil
}
type MapAuthReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MappedAuthType MapAuthReply_Authtype `protobuf:"varint,1,opt,name=mappedAuthType,proto3,enum=grpcupstream.MapAuthReply_Authtype" json:"mappedAuthType,omitempty"`
MappedAuthParam []byte `protobuf:"bytes,2,opt,name=mappedAuthParam,proto3" json:"mappedAuthParam,omitempty"`
}
func (x *MapAuthReply) Reset() {
*x = MapAuthReply{}
if protoimpl.UnsafeEnabled {
mi := &file_upstream_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MapAuthReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MapAuthReply) ProtoMessage() {}
func (x *MapAuthReply) ProtoReflect() protoreflect.Message {
mi := &file_upstream_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MapAuthReply.ProtoReflect.Descriptor instead.
func (*MapAuthReply) Descriptor() ([]byte, []int) {
return file_upstream_proto_rawDescGZIP(), []int{3}
}
func (x *MapAuthReply) GetMappedAuthType() MapAuthReply_Authtype {
if x != nil {
return x.MappedAuthType
}
return MapAuthReply_PASSTHROUGH
}
func (x *MapAuthReply) GetMappedAuthParam() []byte {
if x != nil {
return x.MappedAuthParam
}
return nil
}
var File_upstream_proto protoreflect.FileDescriptor
var file_upstream_proto_rawDesc = []byte{
0x0a, 0x0e, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x0c, 0x67, 0x72, 0x70, 0x63, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x22, 0x4d,
0x0a, 0x13, 0x46, 0x69, 0x6e, 0x64, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x22, 0x6f, 0x0a,
0x11, 0x46, 0x69, 0x6e, 0x64, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x70,
0x6c, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x6d, 0x61,
0x70, 0x70, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0e, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xf8,
0x01, 0x0a, 0x0e, 0x4d, 0x61, 0x70, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a,
0x08, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, 0x54, 0x79, 0x70,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x75, 0x70,
0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x4d, 0x61, 0x70, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x74, 0x79, 0x70, 0x65, 0x52, 0x08,
0x61, 0x75, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x61, 0x75, 0x74,
0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x31, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x74, 0x79,
0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08,
0x50, 0x41, 0x53, 0x53, 0x57, 0x4f, 0x52, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x55,
0x42, 0x4c, 0x49, 0x43, 0x4b, 0x45, 0x59, 0x10, 0x02, 0x22, 0xe9, 0x01, 0x0a, 0x0c, 0x4d, 0x61,
0x70, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x4b, 0x0a, 0x0e, 0x6d, 0x61,
0x70, 0x70, 0x65, 0x64, 0x41, 0x75, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x2e, 0x4d, 0x61, 0x70, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 0x41,
0x75, 0x74, 0x68, 0x74, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x41,
0x75, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x6d, 0x61, 0x70, 0x70, 0x65,
0x64, 0x41, 0x75, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x0f, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x64, 0x41, 0x75, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x22, 0x62, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a,
0x0b, 0x50, 0x41, 0x53, 0x53, 0x54, 0x48, 0x52, 0x4f, 0x55, 0x47, 0x48, 0x10, 0x00, 0x12, 0x0b,
0x0a, 0x07, 0x44, 0x49, 0x53, 0x43, 0x41, 0x52, 0x44, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4e,
0x4f, 0x4e, 0x45, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x41, 0x53, 0x53, 0x57, 0x4f, 0x52,
0x44, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x4b, 0x45,
0x59, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x45, 0x4d, 0x4f, 0x54, 0x45, 0x53, 0x49, 0x47,
0x4e, 0x45, 0x52, 0x10, 0x05, 0x32, 0xaf, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x54, 0x0a, 0x0c, 0x46, 0x69,
0x6e, 0x64, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x21, 0x2e, 0x67, 0x72, 0x70,
0x63, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x55, 0x70,
0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e,
0x67, 0x72, 0x70, 0x63, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x46, 0x69, 0x6e,
0x64, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00,
0x12, 0x45, 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x41, 0x75, 0x74, 0x68, 0x12, 0x1c, 0x2e, 0x67, 0x72,
0x70, 0x63, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x4d, 0x61, 0x70, 0x41, 0x75,
0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63,
0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x4d, 0x61, 0x70, 0x41, 0x75, 0x74, 0x68,
0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x67, 0x31, 0x32, 0x33, 0x2f, 0x73, 0x73, 0x68, 0x70,
0x69, 0x70, 0x65, 0x72, 0x2f, 0x73, 0x73, 0x68, 0x70, 0x69, 0x70, 0x65, 0x72, 0x64, 0x2f, 0x75,
0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x75, 0x70, 0x73, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_upstream_proto_rawDescOnce sync.Once
file_upstream_proto_rawDescData = file_upstream_proto_rawDesc
)
func file_upstream_proto_rawDescGZIP() []byte {
file_upstream_proto_rawDescOnce.Do(func() {
file_upstream_proto_rawDescData = protoimpl.X.CompressGZIP(file_upstream_proto_rawDescData)
})
return file_upstream_proto_rawDescData
}
var file_upstream_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_upstream_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_upstream_proto_goTypes = []interface{}{
(MapAuthRequest_Authtype)(0), // 0: grpcupstream.MapAuthRequest.Authtype
(MapAuthReply_Authtype)(0), // 1: grpcupstream.MapAuthReply.Authtype
(*FindUpstreamRequest)(nil), // 2: grpcupstream.FindUpstreamRequest
(*FindUpstreamReply)(nil), // 3: grpcupstream.FindUpstreamReply
(*MapAuthRequest)(nil), // 4: grpcupstream.MapAuthRequest
(*MapAuthReply)(nil), // 5: grpcupstream.MapAuthReply
}
var file_upstream_proto_depIdxs = []int32{
0, // 0: grpcupstream.MapAuthRequest.authType:type_name -> grpcupstream.MapAuthRequest.Authtype
1, // 1: grpcupstream.MapAuthReply.mappedAuthType:type_name -> grpcupstream.MapAuthReply.Authtype
2, // 2: grpcupstream.UpstreamRegistry.FindUpstream:input_type -> grpcupstream.FindUpstreamRequest
4, // 3: grpcupstream.UpstreamRegistry.MapAuth:input_type -> grpcupstream.MapAuthRequest
3, // 4: grpcupstream.UpstreamRegistry.FindUpstream:output_type -> grpcupstream.FindUpstreamReply
5, // 5: grpcupstream.UpstreamRegistry.MapAuth:output_type -> grpcupstream.MapAuthReply
4, // [4:6] is the sub-list for method output_type
2, // [2:4] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_upstream_proto_init() }
func file_upstream_proto_init() {
if File_upstream_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_upstream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindUpstreamRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_upstream_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindUpstreamReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_upstream_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MapAuthRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_upstream_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MapAuthReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_upstream_proto_rawDesc,
NumEnums: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_upstream_proto_goTypes,
DependencyIndexes: file_upstream_proto_depIdxs,
EnumInfos: file_upstream_proto_enumTypes,
MessageInfos: file_upstream_proto_msgTypes,
}.Build()
File_upstream_proto = out.File
file_upstream_proto_rawDesc = nil
file_upstream_proto_goTypes = nil
file_upstream_proto_depIdxs = nil
}

View file

@ -0,0 +1,47 @@
syntax = "proto3";
package grpcupstream;
option go_package = "github.com/tg123/sshpiper/sshpiperd/upstream/grpcupstream";
service UpstreamRegistry {
rpc FindUpstream (FindUpstreamRequest) returns (FindUpstreamReply) {}
rpc MapAuth(MapAuthRequest) returns (MapAuthReply) {}
}
message FindUpstreamRequest {
string userName = 1;
string fromAddr = 2;
}
message FindUpstreamReply {
string toAddr = 1;
string mappedUserName = 2;
string metadata = 3;
}
message MapAuthRequest {
string userName = 1;
string fromAddr = 2;
string metadata = 3;
enum Authtype {
NONE = 0;
PASSWORD = 1;
PUBLICKEY = 2;
}
Authtype authType = 4;
bytes authParam = 5;
}
message MapAuthReply {
enum Authtype {
PASSTHROUGH = 0;
DISCARD = 1;
NONE = 2;
PASSWORD = 3;
PRIVATEKEY = 4;
REMOTESIGNER = 5;
}
Authtype mappedAuthType = 1;
bytes mappedAuthParam = 2;
}

View file

@ -0,0 +1,137 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package grpcupstream
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// UpstreamRegistryClient is the client API for UpstreamRegistry service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type UpstreamRegistryClient interface {
FindUpstream(ctx context.Context, in *FindUpstreamRequest, opts ...grpc.CallOption) (*FindUpstreamReply, error)
MapAuth(ctx context.Context, in *MapAuthRequest, opts ...grpc.CallOption) (*MapAuthReply, error)
}
type upstreamRegistryClient struct {
cc grpc.ClientConnInterface
}
func NewUpstreamRegistryClient(cc grpc.ClientConnInterface) UpstreamRegistryClient {
return &upstreamRegistryClient{cc}
}
func (c *upstreamRegistryClient) FindUpstream(ctx context.Context, in *FindUpstreamRequest, opts ...grpc.CallOption) (*FindUpstreamReply, error) {
out := new(FindUpstreamReply)
err := c.cc.Invoke(ctx, "/grpcupstream.UpstreamRegistry/FindUpstream", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *upstreamRegistryClient) MapAuth(ctx context.Context, in *MapAuthRequest, opts ...grpc.CallOption) (*MapAuthReply, error) {
out := new(MapAuthReply)
err := c.cc.Invoke(ctx, "/grpcupstream.UpstreamRegistry/MapAuth", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// UpstreamRegistryServer is the server API for UpstreamRegistry service.
// All implementations must embed UnimplementedUpstreamRegistryServer
// for forward compatibility
type UpstreamRegistryServer interface {
FindUpstream(context.Context, *FindUpstreamRequest) (*FindUpstreamReply, error)
MapAuth(context.Context, *MapAuthRequest) (*MapAuthReply, error)
mustEmbedUnimplementedUpstreamRegistryServer()
}
// UnimplementedUpstreamRegistryServer must be embedded to have forward compatible implementations.
type UnimplementedUpstreamRegistryServer struct {
}
func (UnimplementedUpstreamRegistryServer) FindUpstream(context.Context, *FindUpstreamRequest) (*FindUpstreamReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindUpstream not implemented")
}
func (UnimplementedUpstreamRegistryServer) MapAuth(context.Context, *MapAuthRequest) (*MapAuthReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method MapAuth not implemented")
}
func (UnimplementedUpstreamRegistryServer) mustEmbedUnimplementedUpstreamRegistryServer() {}
// UnsafeUpstreamRegistryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to UpstreamRegistryServer will
// result in compilation errors.
type UnsafeUpstreamRegistryServer interface {
mustEmbedUnimplementedUpstreamRegistryServer()
}
func RegisterUpstreamRegistryServer(s grpc.ServiceRegistrar, srv UpstreamRegistryServer) {
s.RegisterService(&UpstreamRegistry_ServiceDesc, srv)
}
func _UpstreamRegistry_FindUpstream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FindUpstreamRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UpstreamRegistryServer).FindUpstream(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/grpcupstream.UpstreamRegistry/FindUpstream",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UpstreamRegistryServer).FindUpstream(ctx, req.(*FindUpstreamRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UpstreamRegistry_MapAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MapAuthRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UpstreamRegistryServer).MapAuth(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/grpcupstream.UpstreamRegistry/MapAuth",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UpstreamRegistryServer).MapAuth(ctx, req.(*MapAuthRequest))
}
return interceptor(ctx, in, info, handler)
}
// UpstreamRegistry_ServiceDesc is the grpc.ServiceDesc for UpstreamRegistry service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var UpstreamRegistry_ServiceDesc = grpc.ServiceDesc{
ServiceName: "grpcupstream.UpstreamRegistry",
HandlerType: (*UpstreamRegistryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "FindUpstream",
Handler: _UpstreamRegistry_FindUpstream_Handler,
},
{
MethodName: "MapAuth",
Handler: _UpstreamRegistry_MapAuth_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "upstream.proto",
}

2
ver
View file

@ -1 +1 @@
v0.5.1
v0.6.0