22 lines
		
	
	
		
			424 B
		
	
	
	
		
			Go
		
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			424 B
		
	
	
	
		
			Go
		
	
	
| package myregistry
 | |
| 
 | |
| import "fmt"
 | |
| 
 | |
| type ServiceInfo struct {
 | |
| 	ServiceName string
 | |
| 	Ip          string
 | |
| 	Port        int
 | |
| 	Extend      map[string]string
 | |
| }
 | |
| 
 | |
| func (s *ServiceInfo) String() string {
 | |
| 	return fmt.Sprintf("%s - %s:%d", s.ServiceName, s.Ip, s.Port)
 | |
| }
 | |
| 
 | |
| // IRegister 注册中心 服务注册发现
 | |
| type IRegister interface {
 | |
| 	Name() string
 | |
| 	Register(service *ServiceInfo) error
 | |
| 	Deregister(service *ServiceInfo) error
 | |
| }
 |