Merge pull request #507 from rex4539/typos

Fix typos
This commit is contained in:
Silver 2021-11-15 10:04:13 -06:00 committed by GitHub
commit d4733efb25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 29 additions and 29 deletions

View File

@ -54,7 +54,7 @@ func (c *StdinoutStream) Write(p []byte) (int, error) {
return os.Stdout.Write(p) 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) { func closeRespBody(resp *http.Response) {
if resp != nil { if resp != nil {
_ = resp.Body.Close() _ = resp.Body.Close()

View File

@ -66,7 +66,7 @@ func DecodeOriginCert(blocks []byte) (*OriginCert, error) {
originCert.ServiceKey = ntt.ServiceKey originCert.ServiceKey = ntt.ServiceKey
originCert.AccountID = ntt.AccountID originCert.AccountID = ntt.AccountID
} else { } 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 // a new line character
token := string(block.Bytes) token := string(block.Bytes)
s := strings.Split(token, "\n") s := strings.Split(token, "\n")

View File

@ -240,7 +240,7 @@ func login(c *cli.Context) error {
return nil 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 { func ensureURLScheme(url string) string {
url = strings.Replace(strings.ToLower(url), "http://", "https://", 1) url = strings.Replace(strings.ToLower(url), "http://", "https://", 1)
if !strings.HasPrefix(url, "https://") { if !strings.HasPrefix(url, "https://") {

View File

@ -47,7 +47,7 @@ type batchData struct {
} }
// WorkersVersion implements the Version interface. // 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 { type WorkersVersion struct {
downloadURL string downloadURL string
checksum string checksum string

View File

@ -125,7 +125,7 @@ func (c *HTTP2Connection) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case TypeTCP: case TypeTCP:
host, err := getRequestHost(r) host, err := getRequestHost(r)
if err != nil { 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) c.log.Error().Err(err)
respWriter.WriteErrorResponse() respWriter.WriteErrorResponse()
} }

View File

@ -42,7 +42,7 @@ const (
// H2mux on HTTP2 failure to connect. // H2mux on HTTP2 failure to connect.
HTTP2Warp HTTP2Warp
//QUICWarp is used only with named tunnels. It's useful for warp-routing where we want to fallback to HTTP2 but //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 QUICWarp
) )

View File

@ -26,7 +26,7 @@ var (
func mockFetcher(getError bool, protocolPercent ...edgediscovery.ProtocolPercent) PercentageFetcher { func mockFetcher(getError bool, protocolPercent ...edgediscovery.ProtocolPercent) PercentageFetcher {
return func() (edgediscovery.ProtocolPercents, error) { return func() (edgediscovery.ProtocolPercents, error) {
if getError { if getError {
return nil, fmt.Errorf("failed to fetch precentage") return nil, fmt.Errorf("failed to fetch percentage")
} }
return protocolPercent, nil return protocolPercent, nil
} }

View File

@ -72,7 +72,7 @@ def get_or_create_release(repo, version, dry_run=False):
except UnknownObjectException: except UnknownObjectException:
logging.info("Release %s not found", version) 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) assert_tag_exists(repo, version)
if dry_run: 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) pass # the macOS release copy fails with being the same file (already in the artifacts directory)
def main(): 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: try:
args = parse_args() args = parse_args()
client = Github(args.api_key) client = Github(args.api_key)

View File

@ -93,7 +93,7 @@ func (m *activeStreamMap) Set(newStream *MuxedStream) bool {
return true 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) { func (m *activeStreamMap) Delete(streamID uint32) {
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()

View File

@ -12,7 +12,7 @@ import (
/* This is an implementation of https://github.com/vkrasnov/h2-compression-dictionaries /* This is an implementation of https://github.com/vkrasnov/h2-compression-dictionaries
but modified for tunnels in a few key ways: but modified for tunnels in a few key ways:
Since tunnels is a server-to-server service, some aspects of the spec would cause 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 allows for parallel compression on the "client", and buffering on the "server" to solve
this problem. */ this problem. */
@ -67,7 +67,7 @@ var compressionPresets = map[CompressionSetting]CompressionPreset{
} }
func compressionSettingVal(version, fmt, sz, nd uint8) uint32 { 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 // * version: only 1 is supported
// * fmt: only 2 for brotli is supported // * fmt: only 2 for brotli is supported
// * sz: log2 of the maximal allowed dictionary size // * sz: log2 of the maximal allowed dictionary size
@ -438,7 +438,7 @@ func assignDictToStream(s *MuxedStream, p []byte) bool {
h2d.dictLock.Lock() h2d.dictLock.Lock()
if w.comp != nil { 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() h2d.dictLock.Unlock()
return false return false
} }
@ -468,7 +468,7 @@ func assignDictToStream(s *MuxedStream, p []byte) bool {
} }
} else { } else {
// Use the overflow dictionary as last resort // 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() useID, _ = h2d.getGenericDictID()
pathID, pathFound = h2d.getNextDictID() pathID, pathFound = h2d.getNextDictID()
if pathFound { if pathFound {

View File

@ -174,7 +174,7 @@ func Handshake(
pingTimestamp := NewPingTimestamp() pingTimestamp := NewPingTimestamp()
connActive := NewSignal() connActive := NewSignal()
idleDuration := config.HeartbeatInterval idleDuration := config.HeartbeatInterval
// Sanity check to enusre idelDuration is sane // Sanity check to ensure idelDuration is sane
if idleDuration == 0 || idleDuration < defaultTimeout { if idleDuration == 0 || idleDuration < defaultTimeout {
idleDuration = defaultTimeout idleDuration = defaultTimeout
config.Log.Info().Msgf("muxer: Minimum idle time has been adjusted to %d", 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] m.compressionQuality = compressionPresets[CompressionNone]
return nil 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 { if sz < m.compressionQuality.dictSize {
m.compressionQuality.dictSize = sz m.compressionQuality.dictSize = sz
} }

View File

@ -130,7 +130,7 @@ func TestMuxMetricsUpdater(t *testing.T) {
m.updateReceiveWindow(uint32(j)) m.updateReceiveWindow(uint32(j))
m.updateSendWindow(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)} rm := &roundTripMeasurement{receiveTime: readerStart, sendTime: readerStart.Add(-time.Duration(j*dataPoints) * time.Millisecond)}
m.updateRTT(rm) m.updateRTT(rm)

View File

@ -97,7 +97,7 @@ func TestDefaultStreamWSOverTCPConnection(t *testing.T) {
} }
// TestSocksStreamWSOverTCPConnection simulates proxying in socks mode. // 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 // wraps SOCKS5 traffic in websocket
// Origin side runs a tcpOverWSConnection with socks.StreamHandler // Origin side runs a tcpOverWSConnection with socks.StreamHandler
func TestSocksStreamWSOverTCPConnection(t *testing.T) { func TestSocksStreamWSOverTCPConnection(t *testing.T) {

View File

@ -767,7 +767,7 @@ func newWSRespWriter(w io.Writer) *wsRespWriter {
func (w *wsRespWriter) Write(p []byte) (int, error) { func (w *wsRespWriter) Write(p []byte) (int, error) {
returnedMsg, err := wsutil.ReadServerBinary(bytes.NewBuffer(p)) returnedMsg, err := wsutil.ReadServerBinary(bytes.NewBuffer(p))
if err != nil { 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 { if err != io.ErrUnexpectedEOF {
return w.w.Write(p) return w.w.Write(p)
} }

View File

@ -91,7 +91,7 @@ func (cm *reconnectCredentialManager) ConnDigest(connID uint8) ([]byte, error) {
defer cm.mu.RUnlock() defer cm.mu.RUnlock()
digest, ok := cm.connDigest[connID] digest, ok := cm.connDigest[connID]
if !ok { 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 return digest, nil
} }

View File

@ -366,7 +366,7 @@ func (sc *serverCollector) lostPackets(reason logging.PacketLossReason) {
func (sc *serverCollector) updatedRTT(rtt *logging.RTTStats) { func (sc *serverCollector) updatedRTT(rtt *logging.RTTStats) {
latestRTT := rtt.LatestRTT() latestRTT := rtt.LatestRTT()
// May return 0 if no valid updates have occured // May return 0 if no valid updates have occurred
if latestRTT > 0 { if latestRTT > 0 {
serverMetrics.rtt.Observe(durationToPromGauge(latestRTT)) serverMetrics.rtt.Observe(durationToPromGauge(latestRTT))
} }

View File

@ -18,7 +18,7 @@ const (
authFailure = uint8(1) authFailure = uint8(1)
) )
// AuthHandler handles socks authenication requests // AuthHandler handles socks authentication requests
type AuthHandler interface { type AuthHandler interface {
Handle(io.Reader, io.Writer) error Handle(io.Reader, io.Writer) error
Register(uint8, Authenticator) Register(uint8, Authenticator)
@ -43,7 +43,7 @@ func (h *StandardAuthHandler) Register(method uint8, a Authenticator) {
h.authenticators[method] = a 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 { func (h *StandardAuthHandler) Handle(bufConn io.Reader, conn io.Writer) error {
methods, err := readMethods(bufConn) methods, err := readMethods(bufConn)
if err != nil { if err != nil {

View File

@ -55,7 +55,7 @@ func (h *StandardRequestHandler) handleConnect(conn io.ReadWriter, req *Request)
addr, err := net.ResolveIPAddr("ip", req.DestAddr.FQDN) addr, err := net.ResolveIPAddr("ip", req.DestAddr.FQDN)
if err != nil { if err != nil {
_ = sendReply(conn, ruleFailure, req.DestAddr) _ = 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 req.DestAddr.IP = addr.IP

View File

@ -178,7 +178,7 @@ class TestSSHShell(TestSSHBase):
self.assertIn(username, pwd) self.assertIn(username, pwd)
# Ensure shell launched with correct user's permissions and privs. # 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( output = self.get_command_output(
session, f"cat {self.ROOT_ONLY_TEST_FILE_PATH}" session, f"cat {self.ROOT_ONLY_TEST_FILE_PATH}"
) )

View File

@ -178,7 +178,7 @@ func getToken(appURL *url.URL, appInfo *AppInfo, useHostOnly bool, log *zerolog.
return token, nil 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 var orgTokenPath string
orgToken, err := GetOrgTokenIfExists(appInfo.AuthDomain) orgToken, err := GetOrgTokenIfExists(appInfo.AuthDomain)
if err != nil { 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, // getTokensFromEdge will attempt to use the transfer service to retrieve an app and org token, save them to disk,
// and return the app token. // and return the app token.
func getTokensFromEdge(appURL *url.URL, appTokenPath, orgTokenPath string, useHostOnly bool, log *zerolog.Logger) (string, error) { 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 // 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 // we want to send to the transfer service. the key is token and the value

View File

@ -49,12 +49,12 @@ func (u *UpstreamHTTPS) Exchange(ctx context.Context, query *dns.Msg) (*dns.Msg,
for _, bootstrap := range u.bootstraps { for _, bootstrap := range u.bootstraps {
endpoint, client, err := configureBootstrap(bootstrap) endpoint, client, err := configureBootstrap(bootstrap)
if err != nil { 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 continue
} }
msg, err := exchange(queryBuf, query.Id, endpoint, client, u.log) msg, err := exchange(queryBuf, query.Id, endpoint, client, u.log)
if err != nil { 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 continue
} }
return msg, nil return msg, nil