func NewTLSConfig(caCertPath, certPath, privKeyPath string) *tls.Config {
	certpool := x509.NewCertPool()
	caCert, err := ioutil.ReadFile(caCertPath)
	if err == nil {
		certpool.AppendCertsFromPEM(caCert)
	} else {
		panic(err)
	}
	cert, err := tls.LoadX509KeyPair(certPath, privKeyPath)
	if err != nil {
		panic(err)
	}
	cert.Leaf, err = x509.ParseCertificate(cert.Certificate[0])
	if err != nil {
		panic(err)
	}
	return &tls.Config{
		RootCAs:            certpool,
		ClientAuth:         tls.NoClientCert,
		ClientCAs:          nil,
		InsecureSkipVerify: false,
		Certificates:       []tls.Certificate{cert},
	}
}
NewTLSConfig creates a new TLS config
package awsiotjobs
import (
	"crypto/tls"
	"crypto/x509"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"sync"
	"time"
	mqtt "github.com/eclipse/paho.mqtt.golang"
)
const jobBaseTopic = "$aws/things/%s/jobs/%s"
const publishTimeout = 2 * time.Second
type Config struct {
	Port            int
	CaCertPath      string
	CertificatePath string
	PrivateKeyPath  string
	Endpoint        string
	ThingName       string
	ClientID        string
	Handler         func(je JobExecutioner)
}
func (c *Config) FromFile(file string) error {
	s, err := ioutil.ReadFile(file)
	if err != nil {
		fmt.Printf("Invalid config file - ignoring\n")
		return err
	}
	json.Unmarshal(s, &c)
	return nil
}
type nextJobPayload struct {
	clientToken string
}