diff --git a/carrier/carrier.go b/carrier/carrier.go index 1e423b77..152430d1 100644 --- a/carrier/carrier.go +++ b/carrier/carrier.go @@ -54,7 +54,7 @@ func (c *StdinoutStream) Write(p []byte) (int, error) { return os.Stdout.Write(p) } -// Helper to allow defering the response close with a check that the resp is not nil +// Helper to allow deferring the response close with a check that the resp is not nil func closeRespBody(resp *http.Response) { if resp != nil { _ = resp.Body.Close() diff --git a/certutil/certutil.go b/certutil/certutil.go index e3b48c62..0e90ed4b 100644 --- a/certutil/certutil.go +++ b/certutil/certutil.go @@ -66,7 +66,7 @@ func DecodeOriginCert(blocks []byte) (*OriginCert, error) { originCert.ServiceKey = ntt.ServiceKey originCert.AccountID = ntt.AccountID } else { - // Try the older format, where the zoneID and service key are seperated by + // Try the older format, where the zoneID and service key are separated by // a new line character token := string(block.Bytes) s := strings.Split(token, "\n") diff --git a/cmd/cloudflared/access/cmd.go b/cmd/cloudflared/access/cmd.go index 25502666..50ccb663 100644 --- a/cmd/cloudflared/access/cmd.go +++ b/cmd/cloudflared/access/cmd.go @@ -240,7 +240,7 @@ func login(c *cli.Context) error { return nil } -// ensureURLScheme prepends a URL with https:// if it doesnt have a scheme. http:// URLs will not be converted. +// ensureURLScheme prepends a URL with https:// if it doesn't have a scheme. http:// URLs will not be converted. func ensureURLScheme(url string) string { url = strings.Replace(strings.ToLower(url), "http://", "https://", 1) if !strings.HasPrefix(url, "https://") { diff --git a/cmd/cloudflared/updater/workers_update.go b/cmd/cloudflared/updater/workers_update.go index 9bc96b1a..443f896d 100644 --- a/cmd/cloudflared/updater/workers_update.go +++ b/cmd/cloudflared/updater/workers_update.go @@ -47,7 +47,7 @@ type batchData struct { } // WorkersVersion implements the Version interface. -// It contains everything needed to preform a version upgrade +// It contains everything needed to perform a version upgrade type WorkersVersion struct { downloadURL string checksum string diff --git a/connection/http2.go b/connection/http2.go index cfe65f78..f119d819 100644 --- a/connection/http2.go +++ b/connection/http2.go @@ -125,7 +125,7 @@ func (c *HTTP2Connection) ServeHTTP(w http.ResponseWriter, r *http.Request) { case TypeTCP: host, err := getRequestHost(r) if err != nil { - err := fmt.Errorf(`cloudflared recieved a warp-routing request with an empty host value: %w`, err) + err := fmt.Errorf(`cloudflared received a warp-routing request with an empty host value: %w`, err) c.log.Error().Err(err) respWriter.WriteErrorResponse() } diff --git a/connection/protocol.go b/connection/protocol.go index b1d86aa6..6fcea894 100644 --- a/connection/protocol.go +++ b/connection/protocol.go @@ -42,7 +42,7 @@ const ( // H2mux on HTTP2 failure to connect. HTTP2Warp //QUICWarp is used only with named tunnels. It's useful for warp-routing where we want to fallback to HTTP2 but - // dont' want HTTP2 to fallback to H2mux + // don't want HTTP2 to fallback to H2mux QUICWarp ) diff --git a/connection/protocol_test.go b/connection/protocol_test.go index 1139c657..f6a1b726 100644 --- a/connection/protocol_test.go +++ b/connection/protocol_test.go @@ -26,7 +26,7 @@ var ( func mockFetcher(getError bool, protocolPercent ...edgediscovery.ProtocolPercent) PercentageFetcher { return func() (edgediscovery.ProtocolPercents, error) { if getError { - return nil, fmt.Errorf("failed to fetch precentage") + return nil, fmt.Errorf("failed to fetch percentage") } return protocolPercent, nil } diff --git a/github_release.py b/github_release.py index 532d0eae..e59a0cbf 100755 --- a/github_release.py +++ b/github_release.py @@ -72,7 +72,7 @@ def get_or_create_release(repo, version, dry_run=False): except UnknownObjectException: logging.info("Release %s not found", version) - # We dont want to create a new release tag if one doesnt already exist + # We don't want to create a new release tag if one doesn't already exist assert_tag_exists(repo, version) if dry_run: @@ -198,7 +198,7 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na pass # the macOS release copy fails with being the same file (already in the artifacts directory) def main(): - """ Attempts to upload Asset to Github Release. Creates Release if it doesnt exist """ + """ Attempts to upload Asset to Github Release. Creates Release if it doesn't exist """ try: args = parse_args() client = Github(args.api_key) diff --git a/h2mux/activestreammap.go b/h2mux/activestreammap.go index d8079d07..02386db3 100644 --- a/h2mux/activestreammap.go +++ b/h2mux/activestreammap.go @@ -93,7 +93,7 @@ func (m *activeStreamMap) Set(newStream *MuxedStream) bool { return true } -// Delete stops tracking the stream. It should be called only after it is closed and resetted. +// Delete stops tracking the stream. It should be called only after it is closed and reset. func (m *activeStreamMap) Delete(streamID uint32) { m.Lock() defer m.Unlock() diff --git a/h2mux/h2_dictionaries.go b/h2mux/h2_dictionaries.go index bf92d58d..5d11bee7 100644 --- a/h2mux/h2_dictionaries.go +++ b/h2mux/h2_dictionaries.go @@ -12,7 +12,7 @@ import ( /* This is an implementation of https://github.com/vkrasnov/h2-compression-dictionaries but modified for tunnels in a few key ways: Since tunnels is a server-to-server service, some aspects of the spec would cause -unnessasary head-of-line blocking on the CPU and on the network, hence this implementation +unnecessary head-of-line blocking on the CPU and on the network, hence this implementation allows for parallel compression on the "client", and buffering on the "server" to solve this problem. */ @@ -67,7 +67,7 @@ var compressionPresets = map[CompressionSetting]CompressionPreset{ } func compressionSettingVal(version, fmt, sz, nd uint8) uint32 { - // Currently the compression settings are inlcude: + // Currently the compression settings are include: // * version: only 1 is supported // * fmt: only 2 for brotli is supported // * sz: log2 of the maximal allowed dictionary size @@ -438,7 +438,7 @@ func assignDictToStream(s *MuxedStream, p []byte) bool { h2d.dictLock.Lock() if w.comp != nil { - // Check again with lock, in therory the inteface allows for unordered writes + // Check again with lock, in therory the interface allows for unordered writes h2d.dictLock.Unlock() return false } @@ -468,7 +468,7 @@ func assignDictToStream(s *MuxedStream, p []byte) bool { } } else { // Use the overflow dictionary as last resort - // If slots are availabe generate new dictioanries for path and content-type + // If slots are available generate new dictionaries for path and content-type useID, _ = h2d.getGenericDictID() pathID, pathFound = h2d.getNextDictID() if pathFound { diff --git a/h2mux/h2mux.go b/h2mux/h2mux.go index c1bf05bb..40c48e4f 100644 --- a/h2mux/h2mux.go +++ b/h2mux/h2mux.go @@ -174,7 +174,7 @@ func Handshake( pingTimestamp := NewPingTimestamp() connActive := NewSignal() idleDuration := config.HeartbeatInterval - // Sanity check to enusre idelDuration is sane + // Sanity check to ensure idelDuration is sane if idleDuration == 0 || idleDuration < defaultTimeout { idleDuration = defaultTimeout config.Log.Info().Msgf("muxer: Minimum idle time has been adjusted to %d", defaultTimeout) @@ -274,7 +274,7 @@ func (m *Muxer) readPeerSettings(magic uint32) error { m.compressionQuality = compressionPresets[CompressionNone] return nil } - // Values used for compression are the mimimum between the two peers + // Values used for compression are the minimum between the two peers if sz < m.compressionQuality.dictSize { m.compressionQuality.dictSize = sz } diff --git a/h2mux/muxmetrics_test.go b/h2mux/muxmetrics_test.go index d65e35af..a9213a2c 100644 --- a/h2mux/muxmetrics_test.go +++ b/h2mux/muxmetrics_test.go @@ -130,7 +130,7 @@ func TestMuxMetricsUpdater(t *testing.T) { m.updateReceiveWindow(uint32(j)) m.updateSendWindow(uint32(j)) - // should always be disgarded since the send time is before readerSend + // should always be discarded since the send time is before readerSend rm := &roundTripMeasurement{receiveTime: readerStart, sendTime: readerStart.Add(-time.Duration(j*dataPoints) * time.Millisecond)} m.updateRTT(rm) diff --git a/ingress/origin_connection_test.go b/ingress/origin_connection_test.go index 7dfff6f0..e89201d7 100644 --- a/ingress/origin_connection_test.go +++ b/ingress/origin_connection_test.go @@ -97,7 +97,7 @@ func TestDefaultStreamWSOverTCPConnection(t *testing.T) { } // TestSocksStreamWSOverTCPConnection simulates proxying in socks mode. -// Eyeball side runs cloudflared accesss tcp with --url flag to start a websocket forwarder which +// Eyeball side runs cloudflared access tcp with --url flag to start a websocket forwarder which // wraps SOCKS5 traffic in websocket // Origin side runs a tcpOverWSConnection with socks.StreamHandler func TestSocksStreamWSOverTCPConnection(t *testing.T) { diff --git a/origin/proxy_test.go b/origin/proxy_test.go index bd500793..9c49d461 100644 --- a/origin/proxy_test.go +++ b/origin/proxy_test.go @@ -767,7 +767,7 @@ func newWSRespWriter(w io.Writer) *wsRespWriter { func (w *wsRespWriter) Write(p []byte) (int, error) { returnedMsg, err := wsutil.ReadServerBinary(bytes.NewBuffer(p)) if err != nil { - // The data was not returned by a websocket connecton. + // The data was not returned by a websocket connection. if err != io.ErrUnexpectedEOF { return w.w.Write(p) } diff --git a/origin/reconnect.go b/origin/reconnect.go index c93c686a..8b43977b 100644 --- a/origin/reconnect.go +++ b/origin/reconnect.go @@ -91,7 +91,7 @@ func (cm *reconnectCredentialManager) ConnDigest(connID uint8) ([]byte, error) { defer cm.mu.RUnlock() digest, ok := cm.connDigest[connID] if !ok { - return nil, fmt.Errorf("no conneciton digest for connection %v", connID) + return nil, fmt.Errorf("no connection digest for connection %v", connID) } return digest, nil } diff --git a/quic/metrics.go b/quic/metrics.go index 29b08a94..480ad371 100644 --- a/quic/metrics.go +++ b/quic/metrics.go @@ -366,7 +366,7 @@ func (sc *serverCollector) lostPackets(reason logging.PacketLossReason) { func (sc *serverCollector) updatedRTT(rtt *logging.RTTStats) { latestRTT := rtt.LatestRTT() - // May return 0 if no valid updates have occured + // May return 0 if no valid updates have occurred if latestRTT > 0 { serverMetrics.rtt.Observe(durationToPromGauge(latestRTT)) } diff --git a/socks/auth_handler.go b/socks/auth_handler.go index 6dd45b62..c72b323b 100644 --- a/socks/auth_handler.go +++ b/socks/auth_handler.go @@ -18,7 +18,7 @@ const ( authFailure = uint8(1) ) -// AuthHandler handles socks authenication requests +// AuthHandler handles socks authentication requests type AuthHandler interface { Handle(io.Reader, io.Writer) error Register(uint8, Authenticator) @@ -43,7 +43,7 @@ func (h *StandardAuthHandler) Register(method uint8, a Authenticator) { h.authenticators[method] = a } -// Handle gets the methods from the SOCKS5 client and authenicates with the first supported method +// Handle gets the methods from the SOCKS5 client and authenticates with the first supported method func (h *StandardAuthHandler) Handle(bufConn io.Reader, conn io.Writer) error { methods, err := readMethods(bufConn) if err != nil { diff --git a/socks/request_handler.go b/socks/request_handler.go index b134dc6b..179c955c 100644 --- a/socks/request_handler.go +++ b/socks/request_handler.go @@ -55,7 +55,7 @@ func (h *StandardRequestHandler) handleConnect(conn io.ReadWriter, req *Request) addr, err := net.ResolveIPAddr("ip", req.DestAddr.FQDN) if err != nil { _ = sendReply(conn, ruleFailure, req.DestAddr) - return fmt.Errorf("unable to resolve host to confirm acceess") + return fmt.Errorf("unable to resolve host to confirm access") } req.DestAddr.IP = addr.IP diff --git a/ssh_server_tests/tests.py b/ssh_server_tests/tests.py index f79f3794..d27fcd7f 100644 --- a/ssh_server_tests/tests.py +++ b/ssh_server_tests/tests.py @@ -178,7 +178,7 @@ class TestSSHShell(TestSSHBase): self.assertIn(username, pwd) # Ensure shell launched with correct user's permissions and privs. - # Cant read root owned 0700 files. + # Can't read root owned 0700 files. output = self.get_command_output( session, f"cat {self.ROOT_ONLY_TEST_FILE_PATH}" ) diff --git a/token/token.go b/token/token.go index 9f3cf2e4..d4f237a9 100644 --- a/token/token.go +++ b/token/token.go @@ -178,7 +178,7 @@ func getToken(appURL *url.URL, appInfo *AppInfo, useHostOnly bool, log *zerolog. return token, nil } - // If an app token couldnt be found on disk, check for an org token and attempt to exchange it for an app token. + // If an app token couldn't be found on disk, check for an org token and attempt to exchange it for an app token. var orgTokenPath string orgToken, err := GetOrgTokenIfExists(appInfo.AuthDomain) if err != nil { @@ -213,7 +213,7 @@ func getToken(appURL *url.URL, appInfo *AppInfo, useHostOnly bool, log *zerolog. // getTokensFromEdge will attempt to use the transfer service to retrieve an app and org token, save them to disk, // and return the app token. func getTokensFromEdge(appURL *url.URL, appTokenPath, orgTokenPath string, useHostOnly bool, log *zerolog.Logger) (string, error) { - // If no org token exists or if it couldnt be exchanged for an app token, then run the transfer service flow. + // If no org token exists or if it couldn't be exchanged for an app token, then run the transfer service flow. // this weird parameter is the resource name (token) and the key/value // we want to send to the transfer service. the key is token and the value diff --git a/tunneldns/https_upstream.go b/tunneldns/https_upstream.go index c5e1c19a..c5130519 100644 --- a/tunneldns/https_upstream.go +++ b/tunneldns/https_upstream.go @@ -49,12 +49,12 @@ func (u *UpstreamHTTPS) Exchange(ctx context.Context, query *dns.Msg) (*dns.Msg, for _, bootstrap := range u.bootstraps { endpoint, client, err := configureBootstrap(bootstrap) if err != nil { - u.log.Err(err).Msgf("failed to configure boostrap upstream %s", bootstrap) + u.log.Err(err).Msgf("failed to configure bootstrap upstream %s", bootstrap) continue } msg, err := exchange(queryBuf, query.Id, endpoint, client, u.log) if err != nil { - u.log.Err(err).Msgf("failed to connect to a boostrap upstream %s", bootstrap) + u.log.Err(err).Msgf("failed to connect to a bootstrap upstream %s", bootstrap) continue } return msg, nil