Refactor error handler

This commit is contained in:
世界 2022-06-30 21:04:30 +08:00
parent 14c8cee479
commit 574f87527b
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
7 changed files with 13 additions and 13 deletions

2
go.mod
View file

@ -3,7 +3,7 @@ module github.com/sagernet/sing-shadowsocks
go 1.18
require (
github.com/sagernet/sing v0.0.0-20220630111757-30b5895320a5
github.com/sagernet/sing v0.0.0-20220630130201-63a57e6e1286
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d
lukechampine.com/blake3 v1.1.7
)

4
go.sum
View file

@ -1,8 +1,8 @@
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.12 h1:p9dKCg8i4gmOxtv35DvrYoWqYzQrvEVdjQ762Y0OqZE=
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
github.com/sagernet/sing v0.0.0-20220630111757-30b5895320a5 h1:/JHYZ6IY4Q0hkxN2NXaFj8lTJloikj8dekOTsGudrFo=
github.com/sagernet/sing v0.0.0-20220630111757-30b5895320a5/go.mod h1:3ZmoGNg/nNJTyHAZFNRSPaXpNIwpDvyIiAUd0KIWV5c=
github.com/sagernet/sing v0.0.0-20220630130201-63a57e6e1286 h1:KQQvqXMEs5V1mUNeH+PrNWpXxJaaWCo+njCaeEgLUR0=
github.com/sagernet/sing v0.0.0-20220630130201-63a57e6e1286/go.mod h1:3ZmoGNg/nNJTyHAZFNRSPaXpNIwpDvyIiAUd0KIWV5c=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b h1:2n253B2r0pYSmEV+UNCQoPfU/FiaizQEK5Gu4Bq4JE8=

View file

@ -228,6 +228,6 @@ func (w *nonePacketWriter) Upstream() any {
return w.source
}
func (s *NoneService) HandleError(err error) {
s.handler.HandleError(err)
func (s *NoneService) NewError(ctx context.Context, err error) {
s.handler.NewError(ctx, err)
}

View file

@ -122,8 +122,8 @@ func (s *Service) newConnection(ctx context.Context, conn net.Conn, metadata M.M
}, metadata)
}
func (s *Service) HandleError(err error) {
s.handler.HandleError(err)
func (s *Service) NewError(ctx context.Context, err error) {
s.handler.NewError(ctx, err)
}
type serverConn struct {

View file

@ -233,6 +233,6 @@ func (s *RelayService[U]) newPacket(ctx context.Context, conn N.PacketConn, buff
return nil
}
func (s *RelayService[U]) HandleError(err error) {
s.handler.HandleError(err)
func (s *RelayService[U]) NewError(ctx context.Context, err error) {
s.handler.NewError(ctx, err)
}

View file

@ -474,8 +474,8 @@ process:
return nil
}
func (s *Service) HandleError(err error) {
s.handler.HandleError(err)
func (s *Service) NewError(ctx context.Context, err error) {
s.handler.NewError(ctx, err)
}
type serverPacketWriter struct {

View file

@ -71,6 +71,6 @@ func (h *multiHandler) NewPacketConnection(ctx context.Context, conn N.PacketCon
return nil
}
func (h *multiHandler) HandleError(err error) {
h.t.Error(err)
func (h *multiHandler) NewError(ctx context.Context, err error) {
h.t.Error(ctx, err)
}