-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to activate HTTPS and HTTP/2 if client supports it
This adds a new `-https` command line option to stripe-mock. When enabled, it comes up serving HTTPS using a self-signed certificate that's bundled into the executable. Go supports serving HTTP/2 almost automatically from `net/http` with HTTPS is activated, so clients that support HTTP/2 can test with it with stripe-mock. The server will fallback to HTTP automatically for clients that don't. I figure this will be handy testing HTTP/2 support in our various client libraries because it's easy to have stripe-mock spit out debug lines that tell us that HTTP/2 has been activated correctly.
- Loading branch information
Showing
5 changed files
with
191 additions
and
7 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
# Cert | ||
|
||
This directory contains a self-signed certificate for | ||
localhost so that stripe-mock can run with HTTPS. You can | ||
generate a new one with this command: | ||
|
||
openssl req -x509 -newkey rsa:4096 -keyout cert/key.pem -out cert/cert.pem -days 3650 -nodes -subj '/CN=localhost' | ||
|
||
And because certificates are bundled with the executable, | ||
you'll need to put the new certificate into a `*.go` file | ||
with go-bindata: | ||
|
||
go generate |
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 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIEpDCCAowCCQDtPflm0eRwCTANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls | ||
b2NhbGhvc3QwHhcNMTgwNzE3MjA0NzAzWhcNMjgwNzE0MjA0NzAzWjAUMRIwEAYD | ||
VQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDB | ||
XUN89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5dDWyb41lG | ||
Xi/HBCxojYTr7IYBnED7X4RtC5g2HZXKgh76M+0DZdWK3U3st18mP5Z5JN6MSgp4 | ||
iD0iixQQZl3pOQBmjMSuQOzouB2QmCAEn0S373hoCG5nijQU7GJhHizKiuo00YG5 | ||
3n0JAWq6/k07aYxJdP1D+unMsIW5QPTYWnQ/SQwSPWdTIkwov5vdtbPd6rtLY6rY | ||
H4CceRQ2UYwfEjtWawVaq23WGGsv1/DApwtUr1+hQewNGWynVwkBiO5//N0q9EqL | ||
K7su3MbjDeaSdzyPbLKsEhPZvKCyoYZ/HjF38Zwe6kOb5f/ghPAkRossREURQyqr | ||
vRAj0swDekeWXxCrIucoS3031UY5pgNBeEUwENZ15w8+ZoS0HjB7Rw== | ||
-----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,52 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDBXUN89XAuVYou | ||
i76SlFqIT4K5LIJrMsMFz3RU6kPWj2HSCB6P4wrmFhVwmziHkE0TKUbyuX9J4ImR | ||
3WBgLdXiBX/uo8B0aAlRQTrqFkFWTYuWJvLEGopLEQVyKpgyJtuCy0K6oM1h2SMq | ||
pphEpfY/x4GmSTkuSUwYcQsEorK6R0anjPtJBvRNm/17/dililW69ptaAoE71NVo | ||
aKnIwOqykfeeGX7sNQOaBOYlR1Lrg+mwgtXo0ig+5kkbkmtw1gviJPJItmIlkaAd | ||
pyAMDmMAojAYXnE6nIos9wx/7wWQalyVvVnV6lF80frPvA39XWn7BVodD6i1F9mO | ||
dU3xi55TqVEPMOzdpJMA3XQnjoiXJJde5lVim7giWhVzE56y1OnuZg2Z/G4tC7Zu | ||
lJXKRHKp2OxWwgrY5eBaoiP2Q3U1k1vZ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G8npgxcb4ilFgES | ||
M5mtNsv7gdBHcFZS4G71Yl0jr7X2/Cut0dynLWKoQ/pcWr0Ul4h9QtSATPVUOpux | ||
hYVvzv1Num7p7NQyxVtp11d/3UtLrf1AcOxG1PIx8wyYB8l3XJbW60bif3hUhOLG | ||
oIfFQw9PNbp4r8UxBsG9ZdDUaadQ/2FhlgRR50aQwKXwZ8BGTX9ql9tz+snJ6lMP | ||
eWb3vDAN/YPbf+jBGYpiOjSf+J1txBsrzqHpmW7NS+DnBhWfnrckf30LbpZ340db | ||
w7yHB5PAYQoO/ElWOcrFf0CZ+HQuaQIHnklDl4+xKeti/7z27uGevd7/os665lhp | ||
AMMCggEBALdtRkfI7Dt2Zh6rF6b8yBpP8nIqzd1i4hw2rPddHlJ38PdpVUwuukhu | ||
mPh5TgXjIub1syjIZ4fcaF/Xug3qzaIGmxyFe1mtZaIlUIEH3RgZELQMoM70h+lZ | ||
qzA6KoNn7woPYC4MoKCQCnUH89m3z0RS8Sn+x26yVBtKwRQQVPggxIzyWD6f/Qp+ | ||
ZgJJK7j2VJ/N8RBxXj2K8CtfWiYx8NH17Ce7KuLEIAYd3gDrv0E1npjt/hnni+uZ | ||
Im6GO3wa7eZ9vrE41CUTV2s29kSM5ESAUCsPbzUrWJJztVz4O0HkEV4U7klOOCUf | ||
pNup6c6DNzJiw9HN1eEUFBNtiVVIRrI= | ||
-----END 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