Skip to content

Commit

Permalink
revert model changes
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellacosse committed Mar 6, 2024
1 parent fefa87e commit a18b00a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/www/app/cordova_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {Tunnel, TunnelStatus} from './tunnel';
import {AbstractUpdater} from './updater';
import * as interceptors from './url_interceptor';
import {FakeOutlineTunnel} from './fake_tunnel';
import {ShadowsocksSessionConfig} from '../model/shadowsocks_session_config';
import {ShadowsocksSessionConfig} from './tunnel';
import {NoOpVpnInstaller, VpnInstaller} from './vpn_installer';

const OUTLINE_PLUGIN_NAME = 'OutlinePlugin';
Expand Down
3 changes: 1 addition & 2 deletions src/www/app/electron_outline_tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

import * as errors from '../model/errors';

import {Tunnel, TunnelStatus} from './tunnel';
import {ShadowsocksSessionConfig} from '../model/shadowsocks_session_config';
import {Tunnel, TunnelStatus, ShadowsocksSessionConfig} from './tunnel';

export class ElectronOutlineTunnel implements Tunnel {
private statusChangeListener: ((status: TunnelStatus) => void) | null = null;
Expand Down
3 changes: 1 addition & 2 deletions src/www/app/fake_tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

import * as errors from '../model/errors';

import {Tunnel, TunnelStatus} from './tunnel';
import {ShadowsocksSessionConfig} from '../model/shadowsocks_session_config';
import {Tunnel, TunnelStatus, ShadowsocksSessionConfig} from './tunnel';

// Fake Tunnel implementation for demoing and testing.
// Note that because this implementation does not emit disconnection events, "switching" between
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {SHADOWSOCKS_URI} from 'ShadowsocksConfig';

import * as errors from '../../model/errors';

import {ShadowsocksSessionConfig} from '../../model/shadowsocks_session_config';
import {ShadowsocksSessionConfig} from '../tunnel';

// DON'T use these methods outside of this folder!

Expand All @@ -30,15 +30,14 @@ export function staticKeyToShadowsocksSessionConfig(staticKey: string): Shadowso
method: config.method.data,
password: config.password.data,
prefix: config.extra?.['prefix'],
extra: config.extra,
};
} catch (cause) {
throw new errors.ServerAccessKeyInvalid('Invalid static access key.', {cause});
}
}

function parseShadowsocksSessionConfigJson(maybeJsonText: string): ShadowsocksSessionConfig | null {
const {method, password, server, server_port, prefix, extra} = JSON.parse(maybeJsonText);
const {method, password, server, server_port, prefix} = JSON.parse(maybeJsonText);

// These are the mandatory keys.
const missingKeys = [];
Expand All @@ -59,7 +58,6 @@ function parseShadowsocksSessionConfigJson(maybeJsonText: string): ShadowsocksSe
host: server,
port: server_port,
prefix,
extra,
};
}

Expand Down
5 changes: 2 additions & 3 deletions src/www/app/outline_server_repository/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
import * as errors from '../../model/errors';
import * as events from '../../model/events';
import {Server, ServerType} from '../../model/server';
import {ShadowsocksSessionConfig} from '../../model/shadowsocks_session_config';

import {Tunnel, TunnelStatus} from '../tunnel';
import {Tunnel, TunnelStatus, ShadowsocksSessionConfig} from '../tunnel';

import {fetchShadowsocksSessionConfig, staticKeyToShadowsocksSessionConfig} from './access_key_serialization';

Expand All @@ -29,7 +28,7 @@ export class OutlineServer implements Server {
private static readonly SUPPORTED_CIPHERS = ['chacha20-ietf-poly1305', 'aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'];

errorMessageId?: string;
sessionConfig?: ShadowsocksSessionConfig;
private sessionConfig?: ShadowsocksSessionConfig;

constructor(
public readonly id: string,
Expand Down
8 changes: 7 additions & 1 deletion src/www/app/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {ShadowsocksSessionConfig} from '../model/shadowsocks_session_config';
export interface ShadowsocksSessionConfig {
host?: string;
port?: number;
password?: string;
method?: string;
prefix?: string;
}

export const enum TunnelStatus {
CONNECTED,
Expand Down
5 changes: 0 additions & 5 deletions src/www/model/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {ShadowsocksSessionConfig} from './shadowsocks_session_config';

// TODO: add guidelines for this file

export enum ServerType {
Expand All @@ -36,9 +34,6 @@ export interface Server {
// The name of this server, as given by the user.
name: string;

// The configuration used to connect to the server.
sessionConfig?: ShadowsocksSessionConfig;

// The location to pull the session config from on each connection.
sessionConfigLocation?: URL;

Expand Down
22 changes: 0 additions & 22 deletions src/www/model/shadowsocks_session_config.ts

This file was deleted.

0 comments on commit a18b00a

Please sign in to comment.