Add wireguard outbound and test

This commit is contained in:
世界
2022-08-16 23:37:51 +08:00
parent ca94a2ddcb
commit d6a0aa7ccf
20 changed files with 724 additions and 55 deletions

28
box.go
View File

@@ -177,7 +177,33 @@ func (s *Box) Start() error {
for g := 0; g < i; g++ {
s.inbounds[g].Close()
}
return err
var tag string
if in.Tag() == "" {
tag = F.ToString(i)
} else {
tag = in.Tag()
}
return E.Cause(err, "initialize inbound/", in.Type(), "[", tag, "]")
}
}
for i, out := range s.outbounds {
if starter, isStarter := out.(common.Starter); isStarter {
err = starter.Start()
if err != nil {
for _, in := range s.inbounds {
common.Close(in)
}
for g := 0; g < i; g++ {
common.Close(s.outbounds[g])
}
var tag string
if out.Tag() == "" {
tag = F.ToString(i)
} else {
tag = out.Tag()
}
return E.Cause(err, "initialize outbound/", out.Type(), "[", tag, "]")
}
}
}
if s.clashServer != nil {