Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
2ae680f0
Commit
2ae680f0
authored
1 year ago
by
Alena Petraki
Committed by
Pavel Antonov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Исправлена ошибка `unexpected HTTP status code received from server` при запуске любых сборок
parent
66b02b9a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/auth/grpc.go
+10
-1
10 additions, 1 deletion
pkg/auth/grpc.go
with
10 additions
and
1 deletion
pkg/auth/grpc.go
+
10
−
1
View file @
2ae680f0
...
@@ -131,6 +131,15 @@ func WithOAuth2Credentials(ctx context.Context, tokenURL, clientID, clientSecret
...
@@ -131,6 +131,15 @@ func WithOAuth2Credentials(ctx context.Context, tokenURL, clientID, clientSecret
// WithTLSCredentials возвращает опции для создания grpc-соединения с TLS-сертификатами
// WithTLSCredentials возвращает опции для создания grpc-соединения с TLS-сертификатами
func
WithTLSCredentials
(
ctx
context
.
Context
,
cert
,
cacert
,
key
[]
byte
)
(
grpc
.
DialOption
,
error
)
{
func
WithTLSCredentials
(
ctx
context
.
Context
,
cert
,
cacert
,
key
[]
byte
)
(
grpc
.
DialOption
,
error
)
{
creds
,
err
:=
TLSCredentials
(
ctx
,
cert
,
cacert
,
key
)
if
err
!=
nil
{
return
nil
,
err
}
return
grpc
.
WithTransportCredentials
(
creds
),
nil
}
// TLSCredentials возвращает TransportCredentials для создания grpc-соединения с TLS-сертификатами
func
TLSCredentials
(
ctx
context
.
Context
,
cert
,
cacert
,
key
[]
byte
)
(
credentials
.
TransportCredentials
,
error
)
{
certPool
:=
x509
.
NewCertPool
()
certPool
:=
x509
.
NewCertPool
()
if
!
certPool
.
AppendCertsFromPEM
(
cacert
)
{
if
!
certPool
.
AppendCertsFromPEM
(
cacert
)
{
return
nil
,
errors
.
New
(
"CA certificate not loaded"
)
return
nil
,
errors
.
New
(
"CA certificate not loaded"
)
...
@@ -139,5 +148,5 @@ func WithTLSCredentials(ctx context.Context, cert, cacert, key []byte) (grpc.Dia
...
@@ -139,5 +148,5 @@ func WithTLSCredentials(ctx context.Context, cert, cacert, key []byte) (grpc.Dia
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
grpc
.
WithTransportCredentials
(
credentials
.
NewTLS
(
&
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
clientCert
},
RootCAs
:
certPool
})
)
,
nil
return
credentials
.
NewTLS
(
&
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
clientCert
},
RootCAs
:
certPool
}),
nil
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment