Chore: improve code architecture

This commit is contained in:
Dreamacro
2018-11-21 13:47:46 +08:00
parent 91e35f2f6a
commit 01a477bd3d
37 changed files with 926 additions and 990 deletions

View File

@ -1,6 +1,7 @@
package adapters
import (
"encoding/json"
"io"
"net"
"time"
@ -36,6 +37,12 @@ func (r *Reject) Generator(metadata *C.Metadata) (adapter C.ProxyAdapter, err er
return &RejectAdapter{conn: &NopConn{}}, nil
}
func (r *Reject) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]string{
"type": r.Type().String(),
})
}
func NewReject() *Reject {
return &Reject{}
}