// Extract presence information from a TunnelAttrs mask
8957
func (ta TunnelAttrs) present() TunnelAttrsPresence {
	// The kernel requires Ipv4Dst and Ttl to be present, so we
	// always mark those as present, even if we end up wildcarding
	// them.
	return TunnelAttrsPresence{
		TunnelId: !AllBytes(ta.TunnelId[:], 0),
		Ipv4Src:  !AllBytes(ta.Ipv4Src[:], 0),
		Ipv4Dst:  true,
		Tos:      ta.Tos != 0,
		Ttl:      true,
		Df:       ta.Df,
		Csum:     ta.Csum,
		TpSrc:    ta.TpSrc != 0,
		TpDst:    ta.TpDst != 0,
	}
}
666256
func NewVisitor(username string, getPassword func(string) (string, error)) *Visitor {
	return &Visitor{
		username:    username,
		getPassword: getPassword,
	}
}
1287754
func (s *systemd) MaskUnit(u Unit) error {
	masked := u.Destination(s.root)
	if _, err := os.Stat(masked); os.IsNotExist(err) {
		if err := os.MkdirAll(path.Dir(masked), os.FileMode(0755)); err != nil {
			return err
		}
	} else if err := os.Remove(masked); err != nil {
		return err
	}
	return os.Symlink("/dev/null", masked)
}
864154
func ipInMasks(ip net.IP, masks []net.IPNet) bool {
	for _, mask := range masks {
		if mask.Contains(ip) {
			return true
		}
	}
	return false
}
553498
func (l *tarexporter) releaseLayerReferences(imgDescr map[image.ID]*imageDescriptor) error {
	for _, descr := range imgDescr {
		if descr.layerRef != nil {
			os := descr.image.OS
			if os == "" {
				os = runtime.GOOS
			}
			l.lss[os].Release(descr.layerRef)
		}
	}
	return nil
}
677534
func (r Network_Tunnel_Module_Context) GetEncryptionDefault() (resp string, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Tunnel_Module_Context", "getEncryptionDefault", nil, &r.Options, &resp)
	return
}
302169
func MaskError(err error) bool {
	_, ok := errors.Cause(err).(*k8serrors.StatusError)
	return ok
}
893599
func ExtractRestrictHighlightAndSnippetArrays(opts ...interface{}) *opt.RestrictHighlightAndSnippetArraysOption {
	for _, o := range opts {
		if v, ok := o.(*opt.RestrictHighlightAndSnippetArraysOption); ok {
			return v
		}
	}
	return nil
}
831623
func (d *JSONDecoder) DecodePresence(data []byte) (*PresenceRequest, error) {
	var p PresenceRequest
	err := json.Unmarshal(data, &p)
	if err != nil {
		return nil, err
	}
	return &p, nil
}
1170199
func (_class TunnelClass) GetRecord(sessionID SessionRef, self TunnelRef) (_retval TunnelRecord, _err error) {
	_method := "tunnel.get_record"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertTunnelRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertTunnelRecordToGo(_method + " -> ", _result.Value)
	return
}
874735
func extractManifest(tr *tar.Reader, tw *tar.Writer, printManifest bool, newManifest []byte) error {
Tar:
	for {
		hdr, err := tr.Next()
		switch err {
		case io.EOF:
			break Tar
		case nil:
			if filepath.Clean(hdr.Name) == aci.ManifestFile {
				var new_bytes []byte

				bytes, err := ioutil.ReadAll(tr)
				if err != nil {
					return err
				}

				if printManifest && !catPrettyPrint {
					fmt.Println(string(bytes))
				}

				im := &schema.ImageManifest{}
				err = im.UnmarshalJSON(bytes)
				if err != nil {
					return err
				}

				if printManifest && catPrettyPrint {
					output, err := json.MarshalIndent(im, "", "    ")
					if err != nil {
						return err
					}
					fmt.Println(string(output))
				}

				if tw == nil {
					return nil
				}

				if len(newManifest) == 0 {
					err = patchManifest(im)
					if err != nil {
						return err
					}

					new_bytes, err = im.MarshalJSON()
					if err != nil {
						return err
					}
				} else {
					new_bytes = newManifest
				}

				hdr.Size = int64(len(new_bytes))
				err = tw.WriteHeader(hdr)
				if err != nil {
					return err
				}

				_, err = tw.Write(new_bytes)
				if err != nil {
					return err
				}
			} else if tw != nil {
				err := tw.WriteHeader(hdr)
				if err != nil {
					return err
				}
				_, err = io.Copy(tw, tr)
				if err != nil {
					return err
				}
			}
		default:
			return fmt.Errorf("error reading tarball: %v", err)
		}
	}

	return nil
}
300590
func WithPrefixMask(mask idpool.ID) AllocatorOption {
	return func(a *Allocator) { a.prefixMask = mask }
}
900251
func (c *Context) ColorMask(r, g, b, a bool) {
	c.Call("colorMask", r, g, b, a)
}
1021746
func (win *Window) Invisible() (above, below bool) {
	return win.LastWidgetBounds.Y < win.layout.Clip.Y, win.LastWidgetBounds.Y+win.LastWidgetBounds.H > (win.layout.Clip.Y + win.layout.Clip.H)
}
747812
func ExtractIgnorePlurals(opts ...interface{}) *opt.IgnorePluralsOption {
	for _, o := range opts {
		if v, ok := o.(*opt.IgnorePluralsOption); ok {
			return v
		}
	}
	return nil
}
30452
func maskTrailingDash(name string) string {
	if strings.HasSuffix(name, "-") {
		return name[:len(name)-2] + "a"
	}
	return name
}
1213463
func (s *PresenceService) UpsertTunnelConnection(conn services.TunnelConnection) error {
	if err := conn.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	value, err := services.MarshalTunnelConnection(conn)
	if err != nil {
		return trace.Wrap(err)
	}
	_, err = s.Put(context.TODO(), backend.Item{
		Key:     backend.Key(tunnelConnectionsPrefix, conn.GetClusterName(), conn.GetName()),
		Value:   value,
		Expires: conn.Expiry(),
		ID:      conn.GetResourceID(),
	})
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}