github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/util/acme/acme.go (about)

     1  // Copyright 2020 Asim Aslam
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     https://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  // Original source: github.com/micro/go-micro/v3/api/server/acme/acme.go
    16  
    17  // Package acme abstracts away various ACME libraries
    18  package acme
    19  
    20  import (
    21  	"crypto/tls"
    22  	"errors"
    23  	"net"
    24  )
    25  
    26  var (
    27  	// ErrProviderNotImplemented can be returned when attempting to
    28  	// instantiate an unimplemented provider
    29  	ErrProviderNotImplemented = errors.New("Provider not implemented")
    30  )
    31  
    32  // Provider is a ACME provider interface
    33  type Provider interface {
    34  	// Listen returns a new listener
    35  	Listen(...string) (net.Listener, error)
    36  	// TLSConfig returns a tls config
    37  	TLSConfig(...string) (*tls.Config, error)
    38  }
    39  
    40  // The Let's Encrypt ACME endpoints
    41  const (
    42  	LetsEncryptStagingCA    = "https://acme-staging-v02.api.letsencrypt.org/directory"
    43  	LetsEncryptProductionCA = "https://acme-v02.api.letsencrypt.org/directory"
    44  )