Skip to content

Commit

Permalink
Merge branch 'master' into daniellacosse/data-table-primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellacosse authored Feb 4, 2025
2 parents 47ef40e + 7592884 commit 63c2444
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 16 deletions.
14 changes: 14 additions & 0 deletions client/go/outline/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,19 @@ func newClientWithBaseDialers(transportConfig string, tcpDialer transport.Stream
}
}

// Make sure the transport is not proxyless for now.
if transportPair.StreamDialer.ConnType == config.ConnTypeDirect {
return nil, &platerrors.PlatformError{
Code: platerrors.InvalidConfig,
Message: "transport must tunnel TCP traffic",
}
}
if transportPair.PacketListener.ConnType == config.ConnTypeDirect {
return nil, &platerrors.PlatformError{
Code: platerrors.InvalidConfig,
Message: "transport must tunnel UDP traffic",
}
}

return &Client{sd: transportPair.StreamDialer, pl: transportPair.PacketListener}, nil
}
14 changes: 14 additions & 0 deletions client/go/outline/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package outline
import (
"testing"

"github.com/Jigsaw-Code/outline-apps/client/go/outline/platerrors"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -217,6 +218,19 @@ udp:
require.Equal(t, firstHop, result.Client.pl.FirstHop)
}

func Test_NewTransport_DisallowProxyless(t *testing.T) {
config := `
$type: tcpudp
tcp:
udp:`
result := NewClient(config)
require.Error(t, result.Error, "Got %v", result.Error)
perr := &platerrors.PlatformError{}
require.ErrorAs(t, result.Error, &perr)
require.Equal(t, platerrors.InvalidConfig, perr.Code)
require.Equal(t, "transport must tunnel TCP traffic", result.Error.Message)
}

func Test_NewClientFromJSON_Errors(t *testing.T) {
tests := []struct {
name string
Expand Down
10 changes: 5 additions & 5 deletions client/go/outline/config/config_shadowsocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func parseShadowsocksTransport(ctx context.Context, config ConfigNode, parseSE P
if err != nil {
return nil, fmt.Errorf("failed to create PacketListener: %w", err)
}
// For the Shadowsocks transport, the prefix only applies to TCP. To use a prefix with UDP, one needs to
// specify it in the PacketListener config explicitly. This is to ensure backwards-compatibility.
return &TransportPair{
&Dialer[transport.StreamConn]{ConnectionProviderInfo{ConnTypeTunneled, se.FirstHop}, sd.DialStream},
&PacketListener{ConnectionProviderInfo{ConnTypeTunneled, pe.FirstHop}, pl},
Expand Down Expand Up @@ -112,10 +114,6 @@ func parseShadowsocksPacketListener(ctx context.Context, config ConfigNode, pars
if err != nil {
return nil, err
}
if params.SaltGenerator != nil {
return nil, fmt.Errorf("prefix is not yet supported for PacketDialers")
}

pe, err := parsePE(ctx, params.Endpoint)
if err != nil {
return nil, fmt.Errorf("failed to create PacketEndpoint: %w", err)
Expand All @@ -124,7 +122,9 @@ func parseShadowsocksPacketListener(ctx context.Context, config ConfigNode, pars
if err != nil {
return nil, err
}
// TODO: support UDP prefix.
if params.SaltGenerator != nil {
pl.SetSaltGenerator(params.SaltGenerator)
}
return &PacketListener{ConnectionProviderInfo{ConnTypeTunneled, pe.FirstHop}, pl}, nil
}

Expand Down
5 changes: 5 additions & 0 deletions client/go/outline/platerrors/platform_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func (e PlatformError) Error() string {

// Unwrap returns the cause of this [PlatformError].
func (e PlatformError) Unwrap() error {
// Make sure we return a nil value, not an interface value with type `*PlatformError` pointing to nil.
// Otherwise nil equality fails and recursive unwrapping panics.
if e.Cause == nil {
return nil
}
return e.Cause
}

Expand Down
5 changes: 5 additions & 0 deletions client/go/outline/platerrors/platform_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func TestPlatformErrorWrapsCause(t *testing.T) {
require.Nil(t, err.Unwrap())
}

func TestPlatformErrorUnrapsNil(t *testing.T) {
err := PlatformError{Code: InternalError, Message: "some message"}
require.Equal(t, nil, err.Unwrap())
}

func TestEmptyErrorCode(t *testing.T) {
pe := &PlatformError{}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Jigsaw-Code/outline-apps
go 1.22.0

require (
github.com/Jigsaw-Code/outline-sdk v0.0.18-0.20241106233708-faffebb12629
github.com/Jigsaw-Code/outline-sdk v0.0.18
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250131142109-b32720fa2c3e
github.com/Wifx/gonetworkmanager/v2 v2.1.0
github.com/eycorsican/go-tun2socks v1.16.11
Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
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/Jigsaw-Code/outline-sdk v0.0.18-0.20241106233708-faffebb12629 h1:sHi1X4vwtNNBUDCbxynGXe7cM/inwTbavowHziaxlbk=
github.com/Jigsaw-Code/outline-sdk v0.0.18-0.20241106233708-faffebb12629/go.mod h1:CFDKyGZA4zatKE4vMLe8TyQpZCyINOeRFbMAmYHxodw=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250130191133-1f7340826841 h1:1tpY2KX6a9/1/uyN0riQVxQHqNthyAvzIhoWWmdYOBA=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250130191133-1f7340826841/go.mod h1:9iEpNbKBsNU3WJs2XzhlI2AOf6DH018bjWxOC38o1Zc=
github.com/Jigsaw-Code/outline-sdk v0.0.18 h1:xGzbag/jWGVQl5wGy0szr1jb+P8nVDFMcR2mWmgQnqc=
github.com/Jigsaw-Code/outline-sdk v0.0.18/go.mod h1:CFDKyGZA4zatKE4vMLe8TyQpZCyINOeRFbMAmYHxodw=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250131142109-b32720fa2c3e h1:JN3TZFpi98BTw/CZuQWxovFsgqjQ79gGrbvZE1wFIIc=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20250131142109-b32720fa2c3e/go.mod h1:aFUEz6Z/eD0NS3c3fEIX+JO2D9aIrXCmWTb1zJFlItw=
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
Expand Down Expand Up @@ -95,8 +93,6 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down
4 changes: 0 additions & 4 deletions server_manager/messages/master_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1373,10 +1373,6 @@
}
}
},
"server_view_server_metrics_devices_as_breakdown_unit_label": {
"description": "The unit label displayed alongside the devices connected breakdown by AS.",
"message": "Devices"
},
"server_view_server_metrics_advanced_metrics_link": {
"description": "The text of a link that directs the user to a help center article with more detailed information about accessing advanced server metrics.",
"message": "Learn how to view detailed server metrics"
Expand Down

0 comments on commit 63c2444

Please sign in to comment.