https://github.com/mpyw/go-ca-bundle-generator
Generate Go source that provides latest ca-bundle.crt as an inline byte array
https://github.com/mpyw/go-ca-bundle-generator
cabundle certificate go golang tls tls-certificate
Last synced: 9 months ago
JSON representation
Generate Go source that provides latest ca-bundle.crt as an inline byte array
- Host: GitHub
- URL: https://github.com/mpyw/go-ca-bundle-generator
- Owner: mpyw
- License: mit
- Created: 2015-11-15T05:20:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-06-24T14:19:47.000Z (almost 5 years ago)
- Last Synced: 2025-01-11T18:54:59.619Z (over 1 year ago)
- Topics: cabundle, certificate, go, golang, tls, tls-certificate
- Language: Shell
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-ca-bundle-generator
## Why use?
Some environments which have **no latest CA information** may cause TLS errors,
when we try to connect to websites via `https://`.
We need **`ca-bundle.crt`**.
Source: **[https://curl.se/ca/cacert.pem](https://curl.se/ca/cacert.pem)**
## Usage
### Source Generation
Execute `generate.sh` in your project root directory.
```ShellSession
mpyw@localhost:/path/to/project$ curl https://raw.githubusercontent.com/mpyw/go-ca-bundle-generator/master/generate.sh | bash
```
### Package API
Import `./cabundle`.
Now you can use various levels of API.
#### cabundle.GetCertPool()
returns `*x509.CertPool` internally using `ca-bundle.crt`.
#### cabundle.GetTlsConfig()
returns `*tls.Config` internally using `cabundle.GetCertPool()`.
#### cabundle.GetTransport()
returns `*http.Transport` internally using `cabundle.GetTlsConfig()`.
#### cabundle.GetClient()
returns `*http.Client` internally using `cabundle.GetTransport()`.
## Test
`go run test.go` sends a dummy request to Twitter API server.