github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/user.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package protocol
     4  
     5  type UserID interface {
     6  	UUID() [16]byte
     7  	ExistenceTime() Time
     8  	Type() UserType
     9  	ID() [3]byte
    10  }
    11  
    12  // UserType indicate connection user type
    13  // Set desire user by:
    14  // User logical operator OR| to add many types together e.g. (UserType_Person|UserType_Thing)
    15  // User logical operator XOR^ to remove a UserType from base e.g. (UserType_All^UserType_Guest)
    16  // User logical operator NOT^ to reverse a UserType to accept all expect it self! e.g. (^UserType_Guest)
    17  type UserType byte
    18  
    19  // User Type
    20  const (
    21  	UserType_Unset   UserType = 0b00000000 //  Don't know anything about user yet e.g. connection not fully established yet.
    22  	UserType_Guest   UserType = 0b00000001 // (1 << 0) Unknown user type
    23  	UserType_Person  UserType = 0b00000010 // (1 << 1) a human being
    24  	UserType_Thing   UserType = 0b00000100 // (1 << 2) any device or robot with specific intelligence - AI
    25  	UserType_Org     UserType = 0b00001000 // (1 << 3)
    26  	UserType_App     UserType = 0b00010000 // (1 << 4) same app with difference instance
    27  	UserType_Society UserType = 0b00100000 // (1 << 5)
    28  	// UserType_...      UserType = 0b01000000 // (1 << 6)
    29  	// UserType_...      UserType = 0b10000000 // (1 << 7)
    30  	UserType_Known UserType = 0b11111110 // To not indicate user type but not guest one
    31  	UserType_All   UserType = 0b11111111
    32  )