Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna committed Dec 20, 2024
1 parent cffd70a commit d46455e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 73 deletions.
70 changes: 0 additions & 70 deletions client/go/outline/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,73 +47,3 @@ func mapToAny(in map[string]any, out any) error {
decoder.KnownFields(true)
return decoder.Decode(out)
}

/*
type TunnelConfig struct {
Transport TransportConfig
}
type TransportConfig DialerConfig
type DialerConfig any
type EndpointConfig any
type DialEndpointConfig struct {
Address string
Dialer *DialerConfig
}
// ParseTunnelConfig parses and validates the config
func ParseTunnelConfig(configText string) (*TunnelConfig, error) {
var node any
if err := yaml.Unmarshal([]byte(configText), &node); err != nil {
return nil, fmt.Errorf("tunnel config is not valid YAML: %w", err)
}
var tunnel TunnelConfig
var rawTransport TransportConfig
switch typed := node.(type) {
case string:
rawTransport = typed
case map[string]any:
if transport, ok := typed["transport"]; ok {
// TODO: support separate TCP and UDP transports.
rawTransport = transport
} else {
// If the transport field is missing, treat the entire object as the transport config.
rawTransport = typed
}
default:
return nil, fmt.Errorf("tunnel config of type %T is not supported", typed)
}
parsedTransport, err := parseDialerConfig(rawTransport)
if err != nil {
return nil, err
}
tunnel.Transport = parsedTransport
return &tunnel, nil
}
func parseDialerConfig(node any) (DialerConfig, error) {
switch typed := node.(type) {
case string:
// TODO: Implement URL config.
return nil, errors.New("transport string not implemented")
case map[string]any:
if _, ok := typed["$type"]; ok {
// TODO(fortuna): Implement other types.
return nil, errors.New("typed transport not implemented")
}
return parseShadowsocksConfig(typed)
}
return nil, fmt.Errorf("transport config of type %T is not supported", node)
}
*/
1 change: 0 additions & 1 deletion client/go/outline/config/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type DialEndpointConfig struct {
Dialer ConfigNode
}

// TODO(fortuna): implement Endpoint firstHop.
func registerDirectDialEndpoint[ConnType any](r TypeRegistry[*Endpoint[ConnType]], typeID string, newDialer BuildFunc[*Dialer[ConnType]]) {
r.RegisterType(typeID, func(ctx context.Context, config ConfigNode) (*Endpoint[ConnType], error) {
if config == nil {
Expand Down
2 changes: 1 addition & 1 deletion client/src/www/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import {OutlinePlatform} from './platform';
import {Settings} from './settings';
import {EventQueue} from '../model/events';
import { ServerRepository } from '../model/server.js';
import {ServerRepository} from '../model/server.js';

// Used to determine whether to use Polymer functionality on app initialization failure.
let webComponentsAreReady = false;
Expand Down
4 changes: 3 additions & 1 deletion client/src/www/app/outline_server_repository/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export async function parseTunnelConfig(
};
}

export async function parseAccessKey(accessKeyText: string): Promise<ServiceConfig> {
export async function parseAccessKey(
accessKeyText: string
): Promise<ServiceConfig> {
try {
const accessKeyUrl = new URL(accessKeyText.trim());

Expand Down

0 comments on commit d46455e

Please sign in to comment.