Skip to content

Commit

Permalink
Merge pull request #32 from vivekhiwarkar/fix_buf_lint_issue
Browse files Browse the repository at this point in the history
changes after fixing buf lint issue of paralus
  • Loading branch information
niravparikh05 authored Aug 26, 2022
2 parents 4dd5aaf + e29c898 commit dc8fe46
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.
### Added
### Changed
- Removed building images to registry on pull requests [niravparikh05](https://github.com/niravparikh05)
- Changes after fixing lint issue due to buf in paralus core [vivekhiwarkar](https://github.com/vivekhiwarkar)

### Fixed

## [0.1.0] - 2022-06-22
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/inconshreveable/go-vhost v0.0.0-20160627193104-06d84117953b
github.com/jinzhu/inflection v1.0.0
github.com/julienschmidt/httprouter v1.3.0
github.com/paralus/paralus v0.0.0-20220610083417-845812b5f7f2
github.com/paralus/paralus v0.1.3-0.20220826052930-27805eb460bd
github.com/rs/xid v1.3.0
github.com/segmentio/encoding v0.3.4
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/ory/kratos-client-go v0.8.2-alpha.1 h1:YlKhGOSZjounlB9iY4xSWlqHbyLYkeLzlLk8ZL7/nEM=
github.com/ory/kratos-client-go v0.8.2-alpha.1/go.mod h1:dOQIsar76K07wMPJD/6aMhrWyY+sFGEagLDLso1CpsA=
github.com/paralus/paralus v0.0.0-20220610083417-845812b5f7f2 h1:CheJhPqE4jdO8MFI8nHhrq9CbCPyGEJZSd1bPUI0pJE=
github.com/paralus/paralus v0.0.0-20220610083417-845812b5f7f2/go.mod h1:L2m3kVIXTx738VO+YV474WNAiKOnoy32yRbmmYZxlPw=
github.com/paralus/paralus v0.1.3-0.20220826052930-27805eb460bd h1:mm+Y7BdLBx//AyMNGghx6IeCjP5fCy+N/2qqu1ymJlg=
github.com/paralus/paralus v0.1.3-0.20220826052930-27805eb460bd/go.mod h1:L2m3kVIXTx738VO+YV474WNAiKOnoy32yRbmmYZxlPw=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
Expand Down
15 changes: 11 additions & 4 deletions pkg/relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/x509/pkix"
"fmt"
"html"
"math"
"net"
"net/http"
"strconv"
Expand Down Expand Up @@ -184,7 +185,10 @@ func setupserver(log *relaylogger.RelayLog) error {
)
return fmt.Errorf("relay server failed in setupserver")
}
utils.RelayUserPort, err = strconv.Atoi(port)
p, _ := strconv.ParseInt(port, 10, 64)
if p > 0 && p <= math.MaxInt32 {
utils.RelayUserPort = int32(p)
}
if err != nil {
log.Error(
err,
Expand All @@ -203,7 +207,10 @@ func setupserver(log *relaylogger.RelayLog) error {
)
return fmt.Errorf("relay server failed in setupserver")
}
utils.RelayConnectorPort, err = strconv.Atoi(port)
q, _ := strconv.ParseInt(port, 10, 64)
if q > 0 && q <= math.MaxInt32 {
utils.RelayConnectorPort = int32(q)
}
if err != nil {
log.Error(
err,
Expand Down Expand Up @@ -533,7 +540,7 @@ func registerCDRelayUserServer(ctx context.Context, log *relaylogger.RelayLog) e
utils.CDRelayUserCert = cfg.Certificate
utils.CDRelayUserKey = cfg.PrivateKey
utils.CDRelayUserCACert = cfg.CACertificate
utils.CDRelayUserPort = cfg.ServerPort
utils.CDRelayUserPort = int(cfg.ServerPort)
utils.CDRelayUserHost = cfg.ServerHost

return nil
Expand Down Expand Up @@ -631,7 +638,7 @@ func registerCDRelayConnectorServer(ctx context.Context, log *relaylogger.RelayL
utils.CDRelayConnectorKey = cfg.PrivateKey
utils.CDRelayConnectorCACert = cfg.CACertificate
utils.CDRelayConnectorHost = cfg.ServerHost
utils.CDRelayConnectorPort = cfg.ServerPort
utils.CDRelayConnectorPort = int(cfg.ServerPort)

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/tunnel/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (p *authzProvisioner) getAuthz(ctx context.Context, userCN, sni string, cer
}
defer conn.Close()

client := sentryrpc.NewClusterAuthorizationClient(conn)
client := sentryrpc.NewClusterAuthorizationServiceClient(conn)

resp, err := client.GetUserAuthorization(ctx, &sentryrpc.GetUserAuthorizationRequest{
UserCN: userCN,
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var (
RelayUserCACert []byte

//RelayUserPort user facing seerver port
RelayUserPort int
RelayUserPort int32
// RelayUserHost user facing seerver host (domain)
RelayUserHost string
//RelayConnectorCert used for relay-connector termination
Expand All @@ -227,7 +227,7 @@ var (
// RelayConnectorHost connector facing server host (domain)
RelayConnectorHost string
// RelayConnectorPort connector facing server port
RelayConnectorPort int
RelayConnectorPort int32

// CDRelayUserCert used for client/peer communication
CDRelayUserCert []byte
Expand Down Expand Up @@ -532,7 +532,7 @@ func GetRelayIP() string {
// GetRelayIPPort get relay IP:PORT of user facing server
func GetRelayIPPort() string {
if RelayIPFromConfig == "" {
return GetRelayIP() + ":" + strconv.Itoa(RelayUserPort)
return GetRelayIP() + ":" + strconv.Itoa(int(RelayUserPort))
}
return RelayIPFromConfig
}
Expand Down

0 comments on commit dc8fe46

Please sign in to comment.