Skip to content

Commit

Permalink
Merge pull request #43 from wolf-joe/fix_panic
Browse files Browse the repository at this point in the history
feat: fix panic
  • Loading branch information
wolf-joe authored Dec 22, 2022
2 parents f7ac1b2 + e3c4711 commit f29b1cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
11 changes: 6 additions & 5 deletions inbound/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ package inbound
import (
"errors"
"fmt"
"strconv"
"strings"
"sync/atomic"
"time"
"unsafe"

"github.com/miekg/dns"
"github.com/sirupsen/logrus"
"github.com/wolf-joe/ts-dns/cache"
"github.com/wolf-joe/ts-dns/config"
"github.com/wolf-joe/ts-dns/hosts"
"github.com/wolf-joe/ts-dns/outbound"
"github.com/wolf-joe/ts-dns/redirector"
"strconv"
"strings"
"sync/atomic"
"time"
"unsafe"
)

// region interface
Expand Down
9 changes: 5 additions & 4 deletions redirector/redirector.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package redirector
import (
"bufio"
"fmt"
"net"
"os"
"strings"

"github.com/miekg/dns"
"github.com/sirupsen/logrus"
"github.com/wolf-joe/ts-dns/config"
"github.com/wolf-joe/ts-dns/outbound"
"github.com/yl2chen/cidranger"
"net"
"os"
"strings"
)

const (
Expand Down Expand Up @@ -49,7 +50,7 @@ func NewRedirector(globalConf config.Conf, groups map[string]outbound.IGroup) (R
// return runtime redirector
redirector := func(src outbound.IGroup, req, resp *dns.Msg) outbound.IGroup {
instance, exists := group2redir[src.Name()]
if !exists {
if resp == nil || !exists {
return nil
}
newGroup := instance.Redirect(req, resp)
Expand Down

0 comments on commit f29b1cd

Please sign in to comment.