Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
majora-go
Project
Project
Details
Activity
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
majora
majora-go
Commits
2a65e3cd
Commit
2a65e3cd
authored
Sep 28, 2021
by
wei.xuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
release:v0.0.1
parent
41ea9713
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
17 deletions
+6
-17
cli.go
cli.go
+4
-5
client.go
client/client.go
+0
-9
log.go
logger/log.go
+2
-3
majora-cli
majora-cli
+0
-0
No files found.
cli.go
View file @
2a65e3cd
...
...
@@ -22,7 +22,7 @@ var (
natServer
string
account
string
dnsServer
string
disableD
ns
bool
disableD
NS
bool
)
var
(
...
...
@@ -31,15 +31,13 @@ var (
)
func
init
()
{
rand
.
Seed
(
time
.
Now
()
.
UnixNano
())
flag
.
IntVar
(
&
logLevel
,
"log"
,
1
,
"log logLevel"
)
flag
.
BoolVar
(
&
pprof
,
"pprof"
,
false
,
"enable pprof"
)
flag
.
StringVar
(
&
natServer
,
"natServer"
,
common
.
DefNatAddr
,
"natServer"
)
flag
.
StringVar
(
&
account
,
"account"
,
"unknown"
,
"account"
)
flag
.
StringVar
(
&
dnsServer
,
"dnsServer"
,
common
.
DNSServer
,
"custom dns server"
)
flag
.
BoolVar
(
&
disableD
ns
,
"disableDns"
,
false
,
"disable default dns server"
)
flag
.
BoolVar
(
&
disableD
NS
,
"disableDns"
,
false
,
"disable default dns server"
)
flag
.
Parse
()
}
...
...
@@ -54,13 +52,14 @@ func initPprof() {
}()
// for android
if
!
disableD
ns
{
if
!
disableD
NS
{
net
.
DefaultResolver
=
&
net
.
Resolver
{
PreferGo
:
true
,
Dial
:
func
(
ctx
context
.
Context
,
network
,
address
string
)
(
net
.
Conn
,
error
)
{
return
net
.
Dial
(
"udp"
,
dnsServer
)
},
}
logger
.
Info
()
.
Msgf
(
"use custom dns server %s"
,
dnsServer
)
}
}
...
...
client/client.go
View file @
2a65e3cd
...
...
@@ -48,7 +48,6 @@ func (client *Client) StartUp() {
}
client
.
connect
()
client
.
register
()
client
.
Debug
()
client
.
handleNatEvent
()
}
...
...
@@ -136,11 +135,3 @@ func (client *Client) connect() {
logger
.
Info
()
.
Msgf
(
"connect to nathost %s success ..."
,
hostPort
)
client
.
natTunnel
.
Store
(
conn
)
}
func
(
client
*
Client
)
Debug
()
{
//go func() {
// for range time.Tick(time.Second) {
// logger.Warn().Msgf("removeConnection target connStore %+v", client.connStore)
// }
//}()
}
logger/log.go
View file @
2a65e3cd
...
...
@@ -14,7 +14,7 @@ var (
func
init
()
{
zerolog
.
SetGlobalLevel
(
zerolog
.
InfoLevel
)
output
:=
zerolog
.
ConsoleWriter
{
Out
:
os
.
Stdout
,
TimeFormat
:
time
.
RFC3339
,
NoColor
:
true
}
logger
=
zerolog
.
New
(
output
)
.
With
()
.
Caller
()
.
Timestamp
()
.
Logger
()
logger
=
zerolog
.
New
(
output
)
.
With
()
.
Timestamp
()
.
Logger
()
}
var
(
...
...
@@ -24,7 +24,6 @@ var (
Debug
=
logger
.
Debug
)
func
SetLogLevel
(
level
int
)
{
zerolog
.
SetGlobalLevel
(
zerolog
.
Level
(
level
))
}
\ No newline at end of file
}
majora-cli
0 → 100755
View file @
2a65e3cd
File added
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