Skip to content

Green-rainBit/easytls-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Read this in other languages: English, 中文.

easytls-sdk-go

Introduce

easytls-sdk-go is a certificate generation service based on lego's tls, which can stably replace certificates for online services without requiring a restart with just simple configuration.

User Instructions

go get github.com/Green-rainBit/easytls-sdk-go@latest

Obtain Certificate Directly from Let's EncryptFill in the email and key in the easytls.TlsClientConfig, then fill in the configuration information corresponding to the certificate's domain name.You need to pre-obtain the email and key from Let's Encrypt.

package main

import (
	"crypto/tls"
	"fmt"
	"log"
	"net/http"

	"github.com/Green-rainBit/easytls-sdk-go/easytls"
	"github.com/Green-rainBit/easytls-sdk-go/esaylego"
)

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
		fmt.Fprint(res, "Running HTTPS Server!!\n")
	})
	legoConfigUser := esaylego.NewLegoConfigUser("",
		"",
	)
	easytlsConfig := easytls.TlsClientConfig{
		Domains:        []string{"domain.cn"},
		LegoConfigUser: legoConfigUser,
		LegoConfig:     esaylego.NewLegoConfigByUser(legoConfigUser),
		DnsConfig: map[string]string{
			"DNS_CHALLENGE":       "alidns",
			"ALICLOUD_ACCESS_KEY": "",
			"ALICLOUD_SECRET_KEY": "",
		},
	}

	easytlsClient, err := easytls.NewLegoClient(easytlsConfig)
	if err != nil {
		log.Fatal(err)
	}
	srv := &http.Server{
		Addr:    fmt.Sprintf(":%d", 8443),
		Handler: mux,
		TLSConfig: &tls.Config{
			GetCertificate: easytlsClient.GetCertificate(),
		},
	}
	srv.ListenAndServeTLS("", "")
}

Support for Manual Hot Swapping

Just modify the TlsClientConfig configuration content

	easytlsConfig := easytls.TlsClientConfig{
		CertFile: "cert.pem",
		KeyFile:  "key.pem",
	}

Use in conjunction with easy-tls-server

	easytlsConfig := easytls.TlsClientConfig{
		Domains: []string{"www.furniturestore.cn"},
		Host:    "127.0.0.1:8888",
		Scheme:  "http",
	}

Supported DNS operators

Detailed documentation is available here.

Active24 Akamai EdgeDNS Alibaba Cloud DNS all-inkl
Amazon Lightsail Amazon Route 53 ArvanCloud Aurora DNS
Autodns Axelname Azure (deprecated) Azure DNS
Baidu Cloud Bindman Bluecat BookMyName
Brandit (deprecated) Bunny Checkdomain Civo
Cloud.ru CloudDNS Cloudflare ClouDNS
CloudXNS (Deprecated) ConoHa Constellix Core-Networks
CPanel/WHM Derak Cloud deSEC.io Designate DNSaaS for Openstack
Digital Ocean DirectAdmin DNS Made Easy dnsHome.de
DNSimple DNSPod (deprecated) Domain Offensive (do.de) Domeneshop
DreamHost Duck DNS Dyn Dynu
EasyDNS Efficient IP Epik Exoscale
External program F5 XC freemyip.com G-Core
Gandi Gandi Live DNS (v5) Glesys Go Daddy
Google Cloud Google Domains Hetzner Hosting.de
Hosttech HTTP request http.net Huawei Cloud
Hurricane Electric DNS HyperOne IBM Cloud (SoftLayer) IIJ DNS Platform Service
Infoblox Infomaniak Internet Initiative Japan Internet.bs
INWX Ionos IPv64 iwantmyname
Joker Joohoi's ACME-DNS Liara Lima-City
Linode (v4) Liquid Web Loopia LuaDNS
Mail-in-a-Box ManageEngine CloudDNS Manual Metaname
Metaregistrar mijn.host Mittwald myaddr.{tools,dev,io}
MyDNS.jp MythicBeasts Name.com Namecheap
Namesilo NearlyFreeSpeech.NET Netcup Netlify
Nicmanager NIFCloud Njalla Nodion
NS1 Open Telekom Cloud Oracle Cloud OVH
plesk.com Porkbun PowerDNS Rackspace
Rain Yun/雨云 RcodeZero reg.ru Regfish
RFC2136 RimuHosting Sakura Cloud Scaleway
Selectel Selectel v2 SelfHost.(de|eu) Servercow
Shellrent Simply.com Sonic Spaceship
Stackpath Technitium Tencent Cloud DNS Timeweb Cloud
TransIP UKFast SafeDNS Ultradns Variomedia
VegaDNS Vercel Versio.[nl|eu|uk] VinylDNS
VK Cloud Volcano Engine/火山引擎 Vscale Vultr
Webnames Websupport WEDOS West.cn/西部数码
Yandex 360 Yandex Cloud Yandex PDD Zone.ee
Zonomi
你可以将上述内容保存为 `README.md` 文件,以提供英文版的文档说明。

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages