Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
lcc-akm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangmingming
lcc-akm
Commits
9e13dd50
Commit
9e13dd50
authored
Mar 09, 2023
by
王明明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
超时处理
parent
6dca4cf1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
4 deletions
+53
-4
go.mod
src/go.mod
+4
-0
go.sum
src/go.sum
+10
-0
main.go
src/main.go
+38
-2
test.go
src/test.go
+1
-2
No files found.
src/go.mod
View file @
9e13dd50
...
...
@@ -11,6 +11,9 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/klauspost/compress v1.15.12 // indirect
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/tam7t/hpkp v0.0.0-20160821193359-2b70b4024ed5 // indirect
golang.org/x/crypto v0.1.0 // indirect
...
...
@@ -18,4 +21,5 @@ require (
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
)
src/go.sum
View file @
9e13dd50
...
...
@@ -17,11 +17,19 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/klauspost/compress v1.15.12 h1:YClS/PImqYbn+UILDnqxQCZ3RehC9N318SU3kElDUEM=
github.com/klauspost/compress v1.15.12/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA=
github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ=
github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
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/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/tam7t/hpkp v0.0.0-20160821193359-2b70b4024ed5 h1:YqAladjX7xpA6BM04leXMWAEjS0mTZ5kUU9KRBriQJc=
...
...
@@ -38,5 +46,7 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
src/main.go
View file @
9e13dd50
...
...
@@ -5,16 +5,25 @@ import (
nested
"github.com/antonfisher/nested-logrus-formatter"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
"gopkg.in/natefinch/lumberjack.v2"
"log"
"net/http"
"path"
"runtime"
"test/model"
)
func
WelcomeHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprintf
(
w
,
"Welcome!"
)
}
func
getCurrentAbPathByCaller
()
string
{
var
abPath
string
_
,
filename
,
_
,
ok
:=
runtime
.
Caller
(
0
)
if
ok
{
abPath
=
path
.
Dir
(
filename
)
}
return
abPath
}
func
main
()
{
logrus
.
SetLevel
(
logrus
.
TraceLevel
)
//logrus.SetFormatter(&logrus.TextFormatter{
...
...
@@ -26,7 +35,34 @@ func main() {
HideKeys
:
true
,
FieldsOrder
:
[]
string
{
"type"
},
TimestampFormat
:
"2006-01-02 15:04:05.000"
,
//时间格式
NoColors
:
true
,
})
logFilePath
:=
getCurrentAbPathByCaller
()
logFileName
:=
"akm.log"
fileName
:=
path
.
Join
(
logFilePath
,
logFileName
)
// 写入文件
//src, err := os.OpenFile(fileName+".log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, os.ModeAppend)
//logrus.SetOutput(src)
//if err != nil {
// fmt.Println("err", err)
//
//}
logWriter
:=
&
lumberjack
.
Logger
{
// 日志输出文件路径
Filename
:
fileName
,
// 日志文件最大 size, 单位是 MB
MaxSize
:
100
,
// megabytes
// 最大过期日志保留的个数
MaxBackups
:
3
,
// 保留过期文件的最大时间间隔,单位是天
MaxAge
:
28
,
//days
// 是否需要压缩滚动日志, 使用的 gzip 压缩
Compress
:
true
,
// disabled by default
}
logrus
.
SetOutput
(
logWriter
)
//str := "<noscript><img src=\"https://www.easyjet.com/akam/13/pixel_7b9d10f9?a=dD1lMmMzOTBjM2M4NWUyYz\nkzNjljOTNhZDUyNmRkOGJjMDdjNjM2MWJmJmpzPW9mZg==\" style=\"visibility: hidden; position: absolu\nte; left: -999px; top: -999px;\" /></noscript><script type=\"text/javascript\" src=\"/-Hzovq/uluGM/jHPdr/v3N7/m5OOLVXmDOwY/NG4dCQE/Zy/lnEF9qaQI\"></script></body>\n</html>"
//str = "<noscript><img src=\"https://www.easyjet.com/akam/13/pixel_4ac30e0f?a=dD1kZmQ1ODJiODRhNzUxMzAzMDJmN\nTczMjdhMGVlZGEyNWM3MTcwNDY5JmpzPW9mZg==\" style=\"visibility: hidden; position: absolute; left: -999\npx; top: -999px;\" /></noscript><script type=\"text/javascript\" src=\"/9dz5yx/00N2ob/cHtIJhA/oGemj3/BA/SaOXNNXpVab5wO/PVZtb1s9Aw/by/ZID307CB8\"></script></body>\n"
//
...
...
test
/test.go
→
src
/test.go
View file @
9e13dd50
...
...
@@ -17,7 +17,6 @@ func query(data []byte) {
v
:=
model
.
Akm
{}
json
.
Unmarshal
(
data
,
&
v
)
fmt
.
Println
(
string
(
data
))
jar
:=
tls_client
.
NewCookieJar
()
options
:=
[]
tls_client
.
HttpClientOption
{
tls_client
.
WithTimeoutSeconds
(
30
),
...
...
@@ -77,7 +76,7 @@ func main() {
//resp, err := http.Get("http://127.0.0.1:9999/ping")
//resp, err := http.Post("http://lcc.unififi.com/proxy/get-proxy", "application/json", strings.NewReader("{\n \"name\": \"NK\",\n \"type\": \"shopping\"\n}"))
t1
:=
time
.
Now
()
resp
,
err
:=
http
.
Post
(
"http://127.0.0.1:
19999
/akamai/gen"
,
"application/json"
,
strings
.
NewReader
(
"{
\"
type
\"
:
\"
u2
\"
,
\"
proxy
\"
:
\"
http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600
\"
}"
))
resp
,
err
:=
http
.
Post
(
"http://127.0.0.1:
59001
/akamai/gen"
,
"application/json"
,
strings
.
NewReader
(
"{
\"
type
\"
:
\"
u2
\"
,
\"
proxy
\"
:
\"
http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600
\"
}"
))
if
err
!=
nil
{
//panic(err)
fmt
.
Println
(
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment