github.com/decred/dcrlnd@v0.7.6/feature/set.go (about)

     1  package feature
     2  
     3  // Set is an enum identifying various feature sets, which separates the single
     4  // feature namespace into distinct categories depending what context a feature
     5  // vector is being used.
     6  type Set uint8
     7  
     8  const (
     9  	// SetInit identifies features that should be sent in an Init message to
    10  	// a remote peer.
    11  	SetInit Set = iota
    12  
    13  	// SetLegacyGlobal identifies features that should be set in the legacy
    14  	// GlobalFeatures field of an Init message, which maintains backwards
    15  	// compatibility with nodes that haven't implemented flat features.
    16  	SetLegacyGlobal
    17  
    18  	// SetNodeAnn identifies features that should be advertised on node
    19  	// announcements.
    20  	SetNodeAnn
    21  
    22  	// SetInvoice identifies features that should be advertised on invoices
    23  	// generated by the daemon.
    24  	SetInvoice
    25  
    26  	// SetInvoiceAmp identifies the features that should be advertised on
    27  	// AMP invoices generated by the daemon.
    28  	SetInvoiceAmp
    29  )
    30  
    31  // String returns a human-readable description of a Set.
    32  func (s Set) String() string {
    33  	switch s {
    34  	case SetInit:
    35  		return "SetInit"
    36  	case SetLegacyGlobal:
    37  		return "SetLegacyGlobal"
    38  	case SetNodeAnn:
    39  		return "SetNodeAnn"
    40  	case SetInvoice:
    41  		return "SetInvoice"
    42  	case SetInvoiceAmp:
    43  		return "SetInvoiceAmp"
    44  	default:
    45  		return "SetUnknown"
    46  	}
    47  }