|
@@ -18,12 +18,16 @@ import {
|
|
|
createDefaultVmessInboundSettings,
|
|
createDefaultVmessInboundSettings,
|
|
|
createDefaultWireguardInboundSettings,
|
|
createDefaultWireguardInboundSettings,
|
|
|
} from '@/lib/xray/inbound-defaults';
|
|
} from '@/lib/xray/inbound-defaults';
|
|
|
-import { createHysteriaTlsSettingsWithDefaultCert } from '@/lib/xray/inbound-tls-defaults';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ createHysteriaTlsSettingsWithDefaultCert,
|
|
|
|
|
+ createTlsSettingsWithDefaultCert,
|
|
|
|
|
+} from '@/lib/xray/inbound-tls-defaults';
|
|
|
import { HttpInboundSettingsSchema } from '@/schemas/protocols/inbound/http';
|
|
import { HttpInboundSettingsSchema } from '@/schemas/protocols/inbound/http';
|
|
|
import {
|
|
import {
|
|
|
HysteriaClientSchema,
|
|
HysteriaClientSchema,
|
|
|
HysteriaInboundSettingsSchema,
|
|
HysteriaInboundSettingsSchema,
|
|
|
} from '@/schemas/protocols/inbound/hysteria';
|
|
} from '@/schemas/protocols/inbound/hysteria';
|
|
|
|
|
+import { TlsStreamSettingsSchema } from '@/schemas/protocols/security/tls';
|
|
|
import { MixedInboundSettingsSchema } from '@/schemas/protocols/inbound/mixed';
|
|
import { MixedInboundSettingsSchema } from '@/schemas/protocols/inbound/mixed';
|
|
|
import {
|
|
import {
|
|
|
ShadowsocksClientSchema,
|
|
ShadowsocksClientSchema,
|
|
@@ -234,3 +238,19 @@ describe('createHysteriaTlsSettingsWithDefaultCert', () => {
|
|
|
]);
|
|
]);
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+describe('createTlsSettingsWithDefaultCert', () => {
|
|
|
|
|
+ it('keeps the schema ALPN default for non-WebSocket transports', () => {
|
|
|
|
|
+ for (const network of [undefined, '', 'tcp', 'kcp', 'grpc', 'httpupgrade', 'xhttp']) {
|
|
|
|
|
+ const tls = createTlsSettingsWithDefaultCert(network);
|
|
|
|
|
+ expect(tls.alpn).toEqual(['h2', 'http/1.1']);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it("defaults ALPN to http/1.1 for WebSocket (issue #6782)", () => {
|
|
|
|
|
+ const tls = createTlsSettingsWithDefaultCert('ws');
|
|
|
|
|
+ expect(tls.alpn).toEqual(['http/1.1']);
|
|
|
|
|
+ // The overridden value must still satisfy the TLS settings schema.
|
|
|
|
|
+ expect(TlsStreamSettingsSchema.parse(tls).alpn).toEqual(['http/1.1']);
|
|
|
|
|
+ });
|
|
|
|
|
+});
|