Skip to content

Commit

Permalink
Merge branch 'master' into ironrdp
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaiah Becker-Mayer committed Dec 20, 2023
2 parents 92f1bc7 + 0b514aa commit 34e4a48
Show file tree
Hide file tree
Showing 222 changed files with 3,488 additions and 2,225 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/lint-ui-bypass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ on:
pull_request:
paths-ignore:
- 'web/**'
- 'gen/proto/js/**'
merge_group:
paths-ignore:
- 'web/**'
- 'gen/proto/js/**'

jobs:
lint:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ on:
pull_request:
paths:
- 'web/**'
- 'gen/proto/js/**'
merge_group:
paths:
- 'web/**'
- 'gen/proto/js/**'

jobs:
lint:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests-ui-bypass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ on:
paths-ignore:
- '.github/workflows/unit-tests-ui.yaml'
- 'web/**'
- 'gen/proto/js/**'
merge_group:
paths-ignore:
- '.github/workflows/unit-tests-ui.yaml'
- 'web/**'
- 'gen/proto/js/**'

jobs:
lint:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ on:
paths:
- '.github/workflows/unit-tests-ui.yaml'
- 'web/**'
- 'gen/proto/js/**'
merge_group:
paths:
- '.github/workflows/unit-tests-ui.yaml'
- 'web/**'
- 'gen/proto/js/**'

jobs:
test:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ linters-settings:
desc: 'use "sync/atomic" instead'
- pkg: golang.design
desc: 'experimental project, not to be confused with official Go packages'
- pkg: golang.org/x/exp/slices
desc: 'use "slices" instead'
gci:
sections:
- standard # Standard section: captures all standard packages.
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RELEASE_DIR := $(CURDIR)/$(BUILDDIR)/artifacts
ifeq ("$(TELEPORT_DEBUG)","true")
BUILDFLAGS ?= $(ADDFLAGS) -gcflags=all="-N -l"
else
BUILDFLAGS ?= $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath
BUILDFLAGS ?= $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath -buildmode=pie
endif

GO_ENV_OS := $(shell go env GOOS)
Expand Down Expand Up @@ -246,7 +246,7 @@ CC=arm-linux-gnueabihf-gcc
endif

# Add -debugtramp=2 to work around 24 bit CALL/JMP instruction offset.
BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s -debugtramp=2 $(KUBECTL_SETVERSION)' -trimpath
BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s -debugtramp=2 $(KUBECTL_SETVERSION)' -trimpath -buildmode=pie
endif
endif # OS == linux

Expand All @@ -257,7 +257,7 @@ ifneq ("$(ARCH)","amd64")
$(error "Building for windows requires ARCH=amd64")
endif
CGOFLAG = CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++
BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath -buildmode=exe
BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s $(KUBECTL_SETVERSION)' -trimpath -buildmode=pie
endif

CGOFLAG_TSH ?= $(CGOFLAG)
Expand Down
15 changes: 14 additions & 1 deletion api/client/proxy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ import (
"crypto/tls"
"encoding/asn1"
"net"
"slices"
"sync/atomic"
"time"

"github.com/gravitational/trace"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
"golang.org/x/exp/slices"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"

"github.com/gravitational/teleport/api/breaker"
"github.com/gravitational/teleport/api/client"
authpb "github.com/gravitational/teleport/api/client/proto"
"github.com/gravitational/teleport/api/client/proxy/transport/transportv1"
"github.com/gravitational/teleport/api/defaults"
transportv1pb "github.com/gravitational/teleport/api/gen/proto/go/teleport/transport/v1"
Expand Down Expand Up @@ -416,3 +417,15 @@ func (c *Client) ClusterDetails(ctx context.Context) (ClusterDetails, error) {

return ClusterDetails{FIPS: details.FipsEnabled}, nil
}

// Ping measures the round trip latency of sending a message to the Proxy.
func (c *Client) Ping(ctx context.Context) error {
// TODO(tross): Update to call Ping when it is added to the transport service.
// For now we don't really care what method is used we just want to measure
// how long it takes to get a reply. This will always fail with a not implemented
// error since the Proxy gRPC server doesn't serve the auth service proto. However,
// we use it because it's already imported in the api package.
clt := authpb.NewAuthServiceClient(c.grpcConn)
_, _ = clt.Ping(ctx, &authpb.PingRequest{})
return nil
}
2 changes: 1 addition & 1 deletion api/client/proxy/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"net"
"slices"
"testing"
"time"

Expand All @@ -34,7 +35,6 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
"golang.org/x/exp/slices"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
Expand Down
2 changes: 1 addition & 1 deletion api/client/webclient/webclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import (
"net"
"net/http"
"net/http/httptest"
"slices"
"strings"
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/defaults"
apihelpers "github.com/gravitational/teleport/api/testhelpers"
Expand Down
2 changes: 1 addition & 1 deletion api/types/authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package types

import (
"fmt"
"slices"
"time"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/constants"
"github.com/gravitational/teleport/api/utils"
Expand Down
2 changes: 1 addition & 1 deletion api/types/header/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
package header

import (
"slices"
"time"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/types/common"
"github.com/gravitational/teleport/api/utils"
Expand Down
2 changes: 1 addition & 1 deletion api/types/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ limitations under the License.
package types

import (
"slices"
"strings"
"time"

"github.com/coreos/go-semver/semver"
"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/defaults"
"github.com/gravitational/teleport/api/utils"
Expand Down
2 changes: 1 addition & 1 deletion api/types/jamf.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ package types

import (
"net/url"
"slices"
"strings"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion api/types/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ package types
import (
"fmt"
"regexp"
"slices"
"sort"
"time"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/utils"
)
Expand Down
3 changes: 2 additions & 1 deletion api/types/matchers_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package types

import (
"slices"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

apiutils "github.com/gravitational/teleport/api/utils"
awsapiutils "github.com/gravitational/teleport/api/utils/aws"
Expand Down
3 changes: 2 additions & 1 deletion api/types/matchers_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package types

import (
"slices"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

apiutils "github.com/gravitational/teleport/api/utils"
)
Expand Down
3 changes: 2 additions & 1 deletion api/types/matchers_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package types

import (
"slices"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

apiutils "github.com/gravitational/teleport/api/utils"
)
Expand Down
3 changes: 2 additions & 1 deletion api/types/matchers_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package types

import (
"slices"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

apiutils "github.com/gravitational/teleport/api/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion api/types/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ package types

import (
"net/url"
"slices"
"time"

"github.com/gravitational/trace"
"golang.org/x/crypto/ssh"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/constants"
"github.com/gravitational/teleport/api/defaults"
Expand Down
2 changes: 1 addition & 1 deletion api/types/provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ package types

import (
"fmt"
"slices"
"strings"
"time"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/defaults"
apiutils "github.com/gravitational/teleport/api/utils"
Expand Down
31 changes: 30 additions & 1 deletion api/types/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ package types

import (
"regexp"
"slices"
"sort"
"strings"
"time"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/defaults"
"github.com/gravitational/teleport/api/types/common"
Expand Down Expand Up @@ -675,3 +675,32 @@ func FriendlyName(resource ResourceWithLabels) string {

return ""
}

// GetOrigin returns the origin if one can be obtained.
func GetOrigin(v any) string {
switch r := v.(type) {
case ResourceWithOrigin:
return r.Origin()
case ResourceMetadata:
meta := r.GetMetadata()
if meta.Labels == nil {
return ""
}
return meta.Labels[OriginLabel]
}

return ""
}

// GetKind returns the kind if one can be obtained.
func GetKind(v any) string {
type kinder interface {
GetKind() string
}

if k, ok := v.(kinder); ok {
return k.GetKind()
}

return ""
}
2 changes: 1 addition & 1 deletion api/types/resource_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package types
import (
"encoding/json"
"fmt"
"slices"
"strings"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"
)

func (id *ResourceID) CheckAndSetDefaults() error {
Expand Down
2 changes: 1 addition & 1 deletion api/types/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"encoding/json"
"fmt"
"path"
"slices"
"time"

"github.com/gogo/protobuf/proto"
"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/constants"
"github.com/gravitational/teleport/api/defaults"
Expand Down
2 changes: 1 addition & 1 deletion api/types/saml.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ limitations under the License.
package types

import (
"slices"
"strings"
"time"

"github.com/gravitational/trace"
"golang.org/x/crypto/ssh"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/constants"
"github.com/gravitational/teleport/api/defaults"
Expand Down
2 changes: 1 addition & 1 deletion api/types/session_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
package types

import (
"slices"
"time"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"

"github.com/gravitational/teleport/api/defaults"
)
Expand Down
2 changes: 1 addition & 1 deletion api/types/sessionrecording.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ limitations under the License.
package types

import (
"slices"
"strings"
"time"

"github.com/gravitational/trace"
"golang.org/x/exp/slices"
)

// SessionRecordingConfig defines session recording configuration. This is
Expand Down
Loading

0 comments on commit 34e4a48

Please sign in to comment.