Compare commits

...

2 Commits

Author SHA1 Message Date
源文雨
a9b85c6495 fix: dns issue 2024-04-19 01:31:15 +09:00
源文雨
4a7dbf5843 fix: nil trs conn 2024-04-19 01:10:28 +09:00
4 changed files with 62 additions and 3 deletions

26
dns.go Normal file
View File

@ -0,0 +1,26 @@
package main
import "github.com/fumiama/terasu/dns"
func init() {
dns.IPv4Servers.Add(map[string][]string{
"dot.360.cn": {
"101.198.192.33:853",
"112.65.69.15:853",
"101.226.4.6:853",
"218.30.118.6:853",
"123.125.81.6:853",
"140.207.198.6:853",
},
})
dns.IPv6Servers.Add(map[string][]string{
"dot.360.cn": {
"101.198.192.33:853",
"112.65.69.15:853",
"101.226.4.6:853",
"218.30.118.6:853",
"123.125.81.6:853",
"140.207.198.6:853",
},
})
}

2
go.mod
View File

@ -2,7 +2,7 @@ module comandy
go 1.22.1 go 1.22.1
require github.com/fumiama/terasu v0.0.0-20240418151245-719e0c16831b require github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268
require ( require (
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 // indirect github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 // indirect

6
go.sum
View File

@ -4,8 +4,10 @@ github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 h1:S/ferNiehVjNaBMN
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9onRtojoY5sMCLQ7JBgjUsrXDnDKyFxqpf9w= github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9onRtojoY5sMCLQ7JBgjUsrXDnDKyFxqpf9w=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fumiama/terasu v0.0.0-20240418151245-719e0c16831b h1:j6DMJg+jd4HPmhQtVwtiHBM1y9XskJgWhskUvWuhFuY= github.com/fumiama/terasu v0.0.0-20240418160715-5999fcf7db84 h1:dQ4GUL1OHOHHlZ0SOi9ltsuqnmwCUeMNbaLQYs8U1N0=
github.com/fumiama/terasu v0.0.0-20240418151245-719e0c16831b/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM= github.com/fumiama/terasu v0.0.0-20240418160715-5999fcf7db84/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM=
github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268 h1:6R8kSGVSIoR3xm2NG8Z4ivkTpAET783RFsJOVKrI7n8=
github.com/fumiama/terasu v0.0.0-20240418161858-1c3273a78268/go.mod h1:afchyfKAb7J/zvaENtYzjIEPVbwiEjJaow05zzT4usM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=

View File

@ -4,10 +4,41 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"net/http" "net/http"
"sync"
"testing" "testing"
"unsafe"
"github.com/fumiama/terasu/dns"
) )
type testlist struct {
sync.RWMutex
m map[string][]*uintptr
}
func TestRequest(t *testing.T) { func TestRequest(t *testing.T) {
(*testlist)(unsafe.Pointer(&dns.IPv4Servers)).m = make(map[string][]*uintptr)
(*testlist)(unsafe.Pointer(&dns.IPv6Servers)).m = make(map[string][]*uintptr)
dns.IPv4Servers.Add(map[string][]string{
"dot.360.cn": {
"101.198.192.33:853",
"112.65.69.15:853",
"101.226.4.6:853",
"218.30.118.6:853",
"123.125.81.6:853",
"140.207.198.6:853",
},
})
dns.IPv6Servers.Add(map[string][]string{
"dot.360.cn": {
"101.198.192.33:853",
"112.65.69.15:853",
"101.226.4.6:853",
"218.30.118.6:853",
"123.125.81.6:853",
"140.207.198.6:853",
},
})
r := gorequest(`{"code":0,"headers":{"authorization":"Token ","host":"api.mangacopy.com","source":"copyApp","webp":"1","region":"1","version":"2.1.7","platform":"3","user-agent":"COPY/2.1.7"},"method":"GET","url":"https://api.mangacopy.com/api/v3/h5/homeIndex?platform\u003d3"}`) r := gorequest(`{"code":0,"headers":{"authorization":"Token ","host":"api.mangacopy.com","source":"copyApp","webp":"1","region":"1","version":"2.1.7","platform":"3","user-agent":"COPY/2.1.7"},"method":"GET","url":"https://api.mangacopy.com/api/v3/h5/homeIndex?platform\u003d3"}`)
t.Log(r) t.Log(r)
c := capsule{} c := capsule{}