37 lines
		
	
	
	
		
			551 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			551 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package message
 | |
| 
 | |
| import "git.sr.ht/~cco/go-scopes/lib"
 | |
| 
 | |
| // Message implementation(s)
 | |
| 
 | |
| type strMessage string
 | |
| 
 | |
| func (msg strMessage) Action() string {
 | |
| 	return string(msg)
 | |
| }
 | |
| 
 | |
| func (msg strMessage) Sender() lib.Address {
 | |
| 	return nil
 | |
| }
 | |
| 
 | |
| func StrMessage(action string) strMessage {
 | |
| 	return strMessage(action)
 | |
| }
 | |
| 
 | |
| var Quit = StrMessage("quit")
 | |
| 
 | |
| // Address implementation
 | |
| 
 | |
| type address struct {
 | |
| 	service string
 | |
| }
 | |
| 
 | |
| func (addr *address) Service() string {
 | |
| 	return addr.service
 | |
| }
 | |
| 
 | |
| func CreateAddress(srv string) *address {
 | |
| 	return &address{
 | |
| 		service: srv,
 | |
| 	}
 | |
| }
 |