Chore: make the code more semantic

This commit is contained in:
Dreamacro
2018-09-30 12:25:52 +08:00
parent 220e4f0608
commit 2fd59cb31c
40 changed files with 102 additions and 102 deletions

View File

@ -22,14 +22,14 @@ type ProxyAdapter interface {
}
type ServerAdapter interface {
Addr() *Addr
Metadata() *Metadata
Close()
}
type Proxy interface {
Name() string
Type() AdapterType
Generator(addr *Addr) (ProxyAdapter, error)
Generator(metadata *Metadata) (ProxyAdapter, error)
}
// AdapterType is enum of adapter type

View File

@ -28,8 +28,8 @@ func (n *NetWork) String() string {
type SourceType int
// Addr is used to store connection address
type Addr struct {
// Metadata is used to store connection address
type Metadata struct {
NetWork NetWork
Source SourceType
AddrType int
@ -38,7 +38,7 @@ type Addr struct {
Port string
}
func (addr *Addr) String() string {
func (addr *Metadata) String() string {
if addr.Host == "" {
return addr.IP.String()
}

View File

@ -33,7 +33,7 @@ func (rt RuleType) String() string {
type Rule interface {
RuleType() RuleType
IsMatch(addr *Addr) bool
IsMatch(metadata *Metadata) bool
Adapter() string
Payload() string
}