-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Testing for meek, grpc, httpUpgrade Transport (#3160)
* Add instance management based testing * Add testing for meek transport * Add testing for grpc, httpupgrade transport
- Loading branch information
1 parent
531b353
commit d9181ad
Showing
16 changed files
with
624 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIBhDCCASmgAwIBAgIQOGW77bhKIQBVcKBkruQEjDAKBggqhkjOPQQDAjAoMRIw | ||
EAYDVQQKEwlWMlJheSBJbmMxEjAQBgNVBAMTCVYyUmF5IEluYzAeFw0yNDA5MTUx | ||
NjIyMjRaFw0yNDEyMTQxNzIyMjRaMCgxEjAQBgNVBAoTCVYyUmF5IEluYzESMBAG | ||
A1UEAxMJVjJSYXkgSW5jMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmKTCe3pJ | ||
6qYR8JSt4LHurI9ukGQISTBBLrFw8fDsWTeJielnHZdqgKL9swcC+IF/ikjzbT5W | ||
iP0EGUBGk6wbPKM1MDMwDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUF | ||
BwMBMAwGA1UdEwEB/wQCMAAwCgYIKoZIzj0EAwIDSQAwRgIhAKIZM1xlaHwSHsZP | ||
V6aN+AbWnoRgwVVJuY4I5q17FY0cAiEAiLr9NkHd9glFz0BzALygvo7gnNpgF69l | ||
DdiZ4828MXY= | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgmkOATgwafiG4sDs/ | ||
J1xVZfimvgREFJy0mtZHeGM2O6ehRANCAASYpMJ7eknqphHwlK3gse6sj26QZAhJ | ||
MEEusXDx8OxZN4mJ6Wcdl2qAov2zBwL4gX+KSPNtPlaI/QQZQEaTrBs8 | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package scenarios | ||
|
||
import ( | ||
core "github.com/v2fly/v2ray-core/v5" | ||
"github.com/v2fly/v2ray-core/v5/app/instman" | ||
"github.com/v2fly/v2ray-core/v5/common" | ||
"github.com/v2fly/v2ray-core/v5/common/serial" | ||
"github.com/v2fly/v2ray-core/v5/features/extension" | ||
) | ||
|
||
func NewInstanceManagerInstanceConfig() *core.Config { | ||
config := &core.Config{} | ||
config.App = append(config.App, serial.ToTypedMessage(&instman.Config{})) | ||
return config | ||
} | ||
|
||
func NewInstanceManagerCoreInstance() (*core.Instance, extension.InstanceManagement) { | ||
coreConfig := NewInstanceManagerInstanceConfig() | ||
instance, err := core.New(coreConfig) | ||
if err != nil { | ||
panic(err) | ||
} | ||
common.Must(instance.Start()) | ||
instanceMgr := instance.GetFeature(extension.InstanceManagementType()) | ||
InstanceMgrIfce := instanceMgr.(extension.InstanceManagement) | ||
return instance, InstanceMgrIfce | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package scenarios | ||
|
||
import "testing" | ||
|
||
func TestInstanceMgrInit(t *testing.T) { | ||
NewInstanceManagerCoreInstance() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"log": { | ||
"error": { | ||
"level": "Debug", | ||
"type": "Console" | ||
}, | ||
"access": { | ||
"type": "None" | ||
} | ||
}, | ||
"outbounds": [ | ||
{ | ||
"protocol": "vmess", | ||
"settings": { | ||
"address": "127.0.0.1", | ||
"port": 17783, | ||
"uuid": "bcc71618-e552-42c2-a2a3-d4c17a9df764" | ||
}, | ||
"streamSettings": { | ||
"transport": "grpc", | ||
"transportSettings": { | ||
}, | ||
"security": "tls", | ||
"securitySettings": { | ||
"pinnedPeerCertificateChainSha256": [ | ||
"kqHyvea27Pn+JiSqA72lhu9IKAKeGR+3yCyA8JR1mug=" | ||
], | ||
"allowInsecureIfPinnedPeerCertificate": true | ||
} | ||
} | ||
} | ||
], | ||
"inbounds": [ | ||
{ | ||
"protocol": "socks", | ||
"settings": { | ||
"udpEnabled": false, | ||
"address": "127.0.0.1", | ||
"packetEncoding": "Packet" | ||
}, | ||
"port": 17784, | ||
"listen": "127.0.0.1" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"log": { | ||
"error": { | ||
"level": "Debug", | ||
"type": "Console" | ||
}, | ||
"access": { | ||
"type": "None" | ||
} | ||
}, | ||
"outbounds": [ | ||
{ | ||
"protocol": "freedom" | ||
} | ||
], | ||
"inbounds": [ | ||
{ | ||
"listen": "127.0.0.1", | ||
"port": 17783, | ||
"protocol": "vmess", | ||
"settings": { | ||
"users": [ | ||
"bcc71618-e552-42c2-a2a3-d4c17a9df764" | ||
] | ||
}, | ||
"streamSettings": { | ||
"transport": "grpc", | ||
"transportSettings": { | ||
}, | ||
"security": "tls", | ||
"securitySettings": { | ||
"certificate": [ | ||
{ | ||
"usage": "ENCIPHERMENT", | ||
"certificateFile": "cert/self-signed_cert.pem", | ||
"keyFile": "cert/self-signed_key.pem" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"log": { | ||
"error": { | ||
"level": "Debug", | ||
"type": "Console" | ||
}, | ||
"access": { | ||
"type": "None" | ||
} | ||
}, | ||
"outbounds": [ | ||
{ | ||
"protocol": "vmess", | ||
"settings": { | ||
"address": "127.0.0.1", | ||
"port": 17793, | ||
"uuid": "bcc71618-e552-42c2-a2a3-d4c17a9df764" | ||
}, | ||
"streamSettings": { | ||
"transport": "grpc", | ||
"transportSettings": { | ||
"serviceName": "0eae44595474" | ||
}, | ||
"security": "tls", | ||
"securitySettings": { | ||
"pinnedPeerCertificateChainSha256": [ | ||
"kqHyvea27Pn+JiSqA72lhu9IKAKeGR+3yCyA8JR1mug=" | ||
], | ||
"allowInsecureIfPinnedPeerCertificate": true | ||
} | ||
} | ||
} | ||
], | ||
"inbounds": [ | ||
{ | ||
"protocol": "socks", | ||
"settings": { | ||
"udpEnabled": false, | ||
"address": "127.0.0.1", | ||
"packetEncoding": "Packet" | ||
}, | ||
"port": 17794, | ||
"listen": "127.0.0.1" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"log": { | ||
"error": { | ||
"level": "Debug", | ||
"type": "Console" | ||
}, | ||
"access": { | ||
"type": "None" | ||
} | ||
}, | ||
"outbounds": [ | ||
{ | ||
"protocol": "freedom" | ||
} | ||
], | ||
"inbounds": [ | ||
{ | ||
"listen": "127.0.0.1", | ||
"port": 17793, | ||
"protocol": "vmess", | ||
"settings": { | ||
"users": [ | ||
"bcc71618-e552-42c2-a2a3-d4c17a9df764" | ||
] | ||
}, | ||
"streamSettings": { | ||
"transport": "grpc", | ||
"transportSettings": { | ||
"serviceName": "0eae44595474" | ||
}, | ||
"security": "tls", | ||
"securitySettings": { | ||
"certificate": [ | ||
{ | ||
"usage": "ENCIPHERMENT", | ||
"certificateFile": "cert/self-signed_cert.pem", | ||
"keyFile": "cert/self-signed_key.pem" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"log": { | ||
"error": { | ||
"level": "Debug", | ||
"type": "Console" | ||
}, | ||
"access": { | ||
"type": "None" | ||
} | ||
}, | ||
"outbounds": [ | ||
{ | ||
"protocol": "vmess", | ||
"settings": { | ||
"address": "127.0.0.1", | ||
"port": 17793, | ||
"uuid": "bcc71618-e552-42c2-a2a3-d4c17a9df764" | ||
}, | ||
"streamSettings": { | ||
"transport": "httpupgrade", | ||
"transportSettings": { | ||
"path": "b66efc0c7752" | ||
}, | ||
"security": "tls", | ||
"securitySettings": { | ||
"pinnedPeerCertificateChainSha256": [ | ||
"kqHyvea27Pn+JiSqA72lhu9IKAKeGR+3yCyA8JR1mug=" | ||
], | ||
"allowInsecureIfPinnedPeerCertificate": true | ||
} | ||
} | ||
} | ||
], | ||
"inbounds": [ | ||
{ | ||
"protocol": "socks", | ||
"settings": { | ||
"udpEnabled": false, | ||
"address": "127.0.0.1", | ||
"packetEncoding": "Packet" | ||
}, | ||
"port": 17794, | ||
"listen": "127.0.0.1" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"log": { | ||
"error": { | ||
"level": "Debug", | ||
"type": "Console" | ||
}, | ||
"access": { | ||
"type": "None" | ||
} | ||
}, | ||
"outbounds": [ | ||
{ | ||
"protocol": "freedom" | ||
} | ||
], | ||
"inbounds": [ | ||
{ | ||
"listen": "127.0.0.1", | ||
"port": 17793, | ||
"protocol": "vmess", | ||
"settings": { | ||
"users": [ | ||
"bcc71618-e552-42c2-a2a3-d4c17a9df764" | ||
] | ||
}, | ||
"streamSettings": { | ||
"transport": "httpupgrade", | ||
"transportSettings": { | ||
"path": "b66efc0c7752" | ||
}, | ||
"security": "tls", | ||
"securitySettings": { | ||
"certificate": [ | ||
{ | ||
"usage": "ENCIPHERMENT", | ||
"certificateFile": "cert/self-signed_cert.pem", | ||
"keyFile": "cert/self-signed_key.pem" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.