Chore: make the code more semantic
This commit is contained in:
@ -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
|
||||
|
@ -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()
|
||||
}
|
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user