chore: change C.PacketAdapter from a struct to an interface
This commit is contained in:
@ -52,7 +52,7 @@ func (b *Base) RawAddress() string {
|
||||
}
|
||||
|
||||
// ReCreate implements constant.NewListener
|
||||
func (*Base) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- *C.PacketAdapter) error {
|
||||
func (*Base) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- C.PacketAdapter) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ func (h *HTTP) Address() string {
|
||||
}
|
||||
|
||||
// ReCreate implements constant.NewListener
|
||||
func (h *HTTP) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- *C.PacketAdapter) error {
|
||||
func (h *HTTP) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- C.PacketAdapter) error {
|
||||
var err error
|
||||
_ = h.Close()
|
||||
h.l, err = http.NewWithInfos(h.RawAddress(), h.name, h.preferRulesName, tcpIn)
|
||||
|
@ -39,7 +39,7 @@ func (m *Mixed) Address() string {
|
||||
}
|
||||
|
||||
// ReCreate implements constant.NewListener
|
||||
func (m *Mixed) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- *C.PacketAdapter) error {
|
||||
func (m *Mixed) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- C.PacketAdapter) error {
|
||||
var err error
|
||||
_ = m.Close()
|
||||
m.l, err = mixed.NewWithInfos(m.RawAddress(), m.name, m.preferRulesName, tcpIn)
|
||||
|
@ -31,7 +31,7 @@ func (r *Redir) Address() string {
|
||||
}
|
||||
|
||||
// ReCreate implements constant.NewListener
|
||||
func (r *Redir) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- *C.PacketAdapter) error {
|
||||
func (r *Redir) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- C.PacketAdapter) error {
|
||||
var err error
|
||||
_ = r.Close()
|
||||
r.l, err = redir.NewWithInfos(r.Address(), r.name, r.preferRulesName, tcpIn)
|
||||
|
@ -60,7 +60,7 @@ func (s *Socks) Address() string {
|
||||
}
|
||||
|
||||
// ReCreate implements constant.NewListener
|
||||
func (s *Socks) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- *C.PacketAdapter) error {
|
||||
func (s *Socks) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- C.PacketAdapter) error {
|
||||
s.mux.Lock()
|
||||
defer s.mux.Unlock()
|
||||
var err error
|
||||
|
@ -38,7 +38,7 @@ func (t *TProxy) Address() string {
|
||||
}
|
||||
|
||||
// ReCreate implements constant.NewListener
|
||||
func (t *TProxy) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- *C.PacketAdapter) error {
|
||||
func (t *TProxy) ReCreate(tcpIn chan<- C.ConnContext, udpIn chan<- C.PacketAdapter) error {
|
||||
var err error
|
||||
_ = t.Close()
|
||||
t.lTCP, err = tproxy.NewWithInfos(t.RawAddress(), t.name, t.preferRulesName, tcpIn)
|
||||
|
Reference in New Issue
Block a user