TUN-1637: Free tunnels shouldn't require cert.pem
This commit is contained in:
parent
619bc95501
commit
8560436487
|
@ -156,6 +156,7 @@ func prepareTunnelConfig(
|
||||||
logger.WithError(err).Error("Invalid hostname")
|
logger.WithError(err).Error("Invalid hostname")
|
||||||
return nil, errors.Wrap(err, "Invalid hostname")
|
return nil, errors.Wrap(err, "Invalid hostname")
|
||||||
}
|
}
|
||||||
|
isFreeTunnel := hostname == ""
|
||||||
clientID := c.String("id")
|
clientID := c.String("id")
|
||||||
if !c.IsSet("id") {
|
if !c.IsSet("id") {
|
||||||
clientID = generateRandomClientID()
|
clientID = generateRandomClientID()
|
||||||
|
@ -175,10 +176,13 @@ func prepareTunnelConfig(
|
||||||
return nil, errors.Wrap(err, "Error validating origin URL")
|
return nil, errors.Wrap(err, "Error validating origin URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
originCert, err := getOriginCert(c)
|
var originCert []byte
|
||||||
|
if !isFreeTunnel {
|
||||||
|
originCert, err = getOriginCert(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Error getting origin cert")
|
return nil, errors.Wrap(err, "Error getting origin cert")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
originCertPool, err := loadCertPool(c, logger)
|
originCertPool, err := loadCertPool(c, logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -262,6 +266,7 @@ func prepareTunnelConfig(
|
||||||
NoChunkedEncoding: c.Bool("no-chunked-encoding"),
|
NoChunkedEncoding: c.Bool("no-chunked-encoding"),
|
||||||
CompressionQuality: c.Uint64("compression-quality"),
|
CompressionQuality: c.Uint64("compression-quality"),
|
||||||
IncidentLookup: origin.NewIncidentLookup(),
|
IncidentLookup: origin.NewIncidentLookup(),
|
||||||
|
IsFreeTunnel: isFreeTunnel,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ type TunnelConfig struct {
|
||||||
CompressionQuality uint64
|
CompressionQuality uint64
|
||||||
IncidentLookup IncidentLookup
|
IncidentLookup IncidentLookup
|
||||||
CloseConnOnce *sync.Once // Used to close connectedSignal no more than once
|
CloseConnOnce *sync.Once // Used to close connectedSignal no more than once
|
||||||
|
IsFreeTunnel bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type dialError struct {
|
type dialError struct {
|
||||||
|
|
Loading…
Reference in New Issue