mirror of
https://github.com/cloudflare/cloudflared.git
synced 2026-06-23 04:10:20 +00:00
chore: Addressing small fixes and typos
Check / check (1.22.x, macos-latest) (push) Has been cancelled
Check / check (1.22.x, ubuntu-latest) (push) Has been cancelled
Check / check (1.22.x, windows-latest) (push) Has been cancelled
Semgrep config / semgrep/ci (push) Has been cancelled
Check / check (1.22.x, macos-latest) (push) Has been cancelled
Check / check (1.22.x, ubuntu-latest) (push) Has been cancelled
Check / check (1.22.x, windows-latest) (push) Has been cancelled
Semgrep config / semgrep/ci (push) Has been cancelled
This commit is contained in:
+1
-1
@@ -292,7 +292,7 @@ of uptime. Previous cloudflared versions will soon be unable to run legacy tempo
|
|||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
- Tunnel create and delete commands no longer use path to credentials from the configuration file.
|
- Tunnel create and delete commands no longer use path to credentials from the configuration file.
|
||||||
If you need ot place tunnel credentials file at a specific location, you must use `--credentials-file` flag.
|
If you need to place tunnel credentials file at a specific location, you must use `--credentials-file` flag.
|
||||||
- Access ssh-gen creates properly named keys for SSH short lived certs.
|
- Access ssh-gen creates properly named keys for SSH short lived certs.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ You can also use `cloudflared` to access Tunnel origins (that are protected with
|
|||||||
at Layer 4 (i.e., not HTTP/websocket), which is relevant for use cases such as SSH, RDP, etc.
|
at Layer 4 (i.e., not HTTP/websocket), which is relevant for use cases such as SSH, RDP, etc.
|
||||||
Such usages are available under `cloudflared access help`.
|
Such usages are available under `cloudflared access help`.
|
||||||
|
|
||||||
You can instead use [WARP client](https://developers.cloudflare.com/cloudflare-one/team-and-resources/devices/warp/)
|
You can instead use [WARP client](https://developers.cloudflare.com/warp-client/)
|
||||||
to access private origins behind Tunnels for Layer 4 traffic without requiring `cloudflared access` commands on the client side.
|
to access private origins behind Tunnels for Layer 4 traffic without requiring `cloudflared access` commands on the client side.
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ User documentation for Cloudflare Tunnel can be found at https://developers.clou
|
|||||||
|
|
||||||
Once installed, you can authenticate `cloudflared` into your Cloudflare account and begin creating Tunnels to serve traffic to your origins.
|
Once installed, you can authenticate `cloudflared` into your Cloudflare account and begin creating Tunnels to serve traffic to your origins.
|
||||||
|
|
||||||
* Create a Tunnel with [these instructions](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/get-started/)
|
* Create a Tunnel with [these instructions](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/get-started/create-remote-tunnel/)
|
||||||
* Route traffic to that Tunnel:
|
* Route traffic to that Tunnel:
|
||||||
* Via public [DNS records in Cloudflare](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/routing-to-tunnel/dns/)
|
* Via public [DNS records in Cloudflare](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/routing-to-tunnel/dns/)
|
||||||
* Or via a public hostname guided by a [Cloudflare Load Balancer](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/routing-to-tunnel/public-load-balancers/)
|
* Or via a public hostname guided by a [Cloudflare Load Balancer](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/routing-to-tunnel/public-load-balancers/)
|
||||||
|
|||||||
+8
-12
@@ -45,9 +45,7 @@ type baseEndpoints struct {
|
|||||||
var _ Client = (*RESTClient)(nil)
|
var _ Client = (*RESTClient)(nil)
|
||||||
|
|
||||||
func NewRESTClient(baseURL, accountTag, zoneTag, authToken, userAgent string, log *zerolog.Logger) (*RESTClient, error) {
|
func NewRESTClient(baseURL, accountTag, zoneTag, authToken, userAgent string, log *zerolog.Logger) (*RESTClient, error) {
|
||||||
if strings.HasSuffix(baseURL, "/") {
|
baseURL = strings.TrimSuffix(baseURL, "/")
|
||||||
baseURL = baseURL[:len(baseURL)-1]
|
|
||||||
}
|
|
||||||
accountLevelEndpoint, err := url.Parse(fmt.Sprintf("%s/accounts/%s/cfd_tunnel", baseURL, accountTag))
|
accountLevelEndpoint, err := url.Parse(fmt.Sprintf("%s/accounts/%s/cfd_tunnel", baseURL, accountTag))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to create account level endpoint")
|
return nil, errors.Wrap(err, "failed to create account level endpoint")
|
||||||
@@ -68,7 +66,7 @@ func NewRESTClient(baseURL, accountTag, zoneTag, authToken, userAgent string, lo
|
|||||||
TLSHandshakeTimeout: defaultTimeout,
|
TLSHandshakeTimeout: defaultTimeout,
|
||||||
ResponseHeaderTimeout: defaultTimeout,
|
ResponseHeaderTimeout: defaultTimeout,
|
||||||
}
|
}
|
||||||
http2.ConfigureTransport(&httpTransport)
|
_ = http2.ConfigureTransport(&httpTransport)
|
||||||
return &RESTClient{
|
return &RESTClient{
|
||||||
baseEndpoints: &baseEndpoints{
|
baseEndpoints: &baseEndpoints{
|
||||||
accountLevel: *accountLevelEndpoint,
|
accountLevel: *accountLevelEndpoint,
|
||||||
@@ -161,7 +159,6 @@ func fetchExhaustively[T any](requestFn func(int) (*http.Response, error)) ([]*T
|
|||||||
if envelope.Pagination.Count < envelope.Pagination.PerPage || len(fullResponse) >= envelope.Pagination.TotalCount {
|
if envelope.Pagination.Count < envelope.Pagination.PerPage || len(fullResponse) >= envelope.Pagination.TotalCount {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return fullResponse, nil
|
return fullResponse, nil
|
||||||
}
|
}
|
||||||
@@ -179,14 +176,13 @@ func fetchPage[T any](requestFn func(int) (*http.Response, error), page int) (*r
|
|||||||
}
|
}
|
||||||
var parsedRspBody []*T
|
var parsedRspBody []*T
|
||||||
return envelope, parsedRspBody, parseResponseBody(envelope, &parsedRspBody)
|
return envelope, parsedRspBody, parseResponseBody(envelope, &parsedRspBody)
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil, nil, errors.New(fmt.Sprintf("Failed to fetch page. Server returned: %d", pageResp.StatusCode))
|
return nil, nil, errors.New(fmt.Sprintf("Failed to fetch page. Server returned: %d", pageResp.StatusCode))
|
||||||
}
|
}
|
||||||
|
|
||||||
type response struct {
|
type response struct {
|
||||||
Success bool `json:"success,omitempty"`
|
Success bool `json:"success,omitempty"`
|
||||||
Errors []apiErr `json:"errors,omitempty"`
|
Errors []apiError `json:"errors,omitempty"`
|
||||||
Messages []string `json:"messages,omitempty"`
|
Messages []string `json:"messages,omitempty"`
|
||||||
Result json.RawMessage `json:"result,omitempty"`
|
Result json.RawMessage `json:"result,omitempty"`
|
||||||
Pagination Pagination `json:"result_info,omitempty"`
|
Pagination Pagination `json:"result_info,omitempty"`
|
||||||
@@ -206,19 +202,19 @@ func (r *response) checkErrors() error {
|
|||||||
if len(r.Errors) == 1 {
|
if len(r.Errors) == 1 {
|
||||||
return r.Errors[0]
|
return r.Errors[0]
|
||||||
}
|
}
|
||||||
var messages string
|
var messagesBuilder strings.Builder
|
||||||
for _, e := range r.Errors {
|
for _, e := range r.Errors {
|
||||||
messages += fmt.Sprintf("%s; ", e)
|
messagesBuilder.WriteString(fmt.Sprintf("%s; ", e))
|
||||||
}
|
}
|
||||||
return fmt.Errorf("API errors: %s", messages)
|
return fmt.Errorf("API errors: %s", messagesBuilder.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
type apiErr struct {
|
type apiError struct {
|
||||||
Code json.Number `json:"code,omitempty"`
|
Code json.Number `json:"code,omitempty"`
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e apiErr) Error() string {
|
func (e apiError) Error() string {
|
||||||
return fmt.Sprintf("code: %v, reason: %s", e.Code, e.Message)
|
return fmt.Sprintf("code: %v, reason: %s", e.Code, e.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ func TestQUICServer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
test := test // capture range variable
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
ctx, cancel := context.WithCancel(t.Context())
|
ctx, cancel := context.WithCancel(t.Context())
|
||||||
// Start a UDP Listener for QUIC.
|
// Start a UDP Listener for QUIC.
|
||||||
@@ -499,7 +498,6 @@ func TestBuildHTTPRequest(t *testing.T) {
|
|||||||
|
|
||||||
log := zerolog.Nop()
|
log := zerolog.Nop()
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test // capture range variable
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
req, err := buildHTTPRequest(t.Context(), test.connectRequest, test.body, 0, &log)
|
req, err := buildHTTPRequest(t.Context(), test.connectRequest, test.body, 0, &log)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
+2
-2
@@ -28,7 +28,7 @@ func FindProtocol(p []byte) (layers.IPProtocol, error) {
|
|||||||
// Next header is in the 7th byte of IPv6 header
|
// Next header is in the 7th byte of IPv6 header
|
||||||
return layers.IPProtocol(p[6]), nil
|
return layers.IPProtocol(p[6]), nil
|
||||||
default:
|
default:
|
||||||
return 0, fmt.Errorf("unknow ip version %d", version)
|
return 0, fmt.Errorf("unknown ip version %d", version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ func (pd *IPDecoder) decodeByVersion(packet []byte) ([]gopacket.LayerType, error
|
|||||||
case 6:
|
case 6:
|
||||||
err = pd.v6parser.DecodeLayers(packet, &decoded)
|
err = pd.v6parser.DecodeLayers(packet, &decoded)
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("unknow ip version %d", version)
|
err = fmt.Errorf("unknown ip version %d", version)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user