Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
1caabf84
Commit
1caabf84
authored
Nov 28, 2019
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
self-defined profiling server address
parent
2d10654b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
13 deletions
+17
-13
.gitignore
.gitignore
+1
-0
cmd/gost/main.go
cmd/gost/main.go
+12
-3
go.mod
go.mod
+2
-0
gost.go
gost.go
+2
-2
ss.go
ss.go
+0
-8
No files found.
.gitignore
View file @
1caabf84
...
...
@@ -8,6 +8,7 @@ _obj
_test
release
debian
bin
# Architecture specific extensions/prefixes
*.[568vq]
...
...
cmd/gost/main.go
View file @
1caabf84
...
...
@@ -18,6 +18,8 @@ import (
var
(
configureFile
string
baseCfg
=
&
baseConfig
{}
pprofAddr
string
pprofEnabled
=
os
.
Getenv
(
"PROFILING"
)
!=
""
)
func
init
()
{
...
...
@@ -28,10 +30,13 @@ func init() {
)
flag
.
Var
(
&
baseCfg
.
route
.
ChainNodes
,
"F"
,
"forward address, can make a forward chain"
)
flag
.
Var
(
&
baseCfg
.
route
.
ServeNodes
,
"L"
,
"listen address, can listen on multiple ports"
)
flag
.
Var
(
&
baseCfg
.
route
.
ServeNodes
,
"L"
,
"listen address, can listen on multiple ports
(required)
"
)
flag
.
StringVar
(
&
configureFile
,
"C"
,
""
,
"configure file"
)
flag
.
BoolVar
(
&
baseCfg
.
Debug
,
"D"
,
false
,
"enable debug log"
)
flag
.
BoolVar
(
&
printVersion
,
"V"
,
false
,
"print version"
)
if
pprofEnabled
{
flag
.
StringVar
(
&
pprofAddr
,
"P"
,
":6060"
,
"profiling HTTP server address"
)
}
flag
.
Parse
()
if
printVersion
{
...
...
@@ -54,9 +59,10 @@ func init() {
}
func
main
()
{
if
os
.
Getenv
(
"PROFILING"
)
!=
""
{
if
pprofEnabled
{
go
func
()
{
log
.
Log
(
http
.
ListenAndServe
(
"127.0.0.1:16060"
,
nil
))
log
.
Log
(
"profiling server on"
,
pprofAddr
)
log
.
Log
(
http
.
ListenAndServe
(
pprofAddr
,
nil
))
}()
}
...
...
@@ -72,7 +78,10 @@ func main() {
tlsConfig
=
&
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
cert
},
}
}
else
{
log
.
Log
(
"load TLS certificate files OK"
)
}
gost
.
DefaultTLSConfig
=
tlsConfig
if
err
:=
start
();
err
!=
nil
{
...
...
go.mod
View file @
1caabf84
module github.com/ginuerzh/gost
go 1.13
require (
git.torproject.org/pluggable-transports/goptlib.git v0.0.0-20180321061416-7d56ec4f381e
git.torproject.org/pluggable-transports/obfs4.git v0.0.0-20181103133120-08f4d470188e
...
...
gost.go
View file @
1caabf84
...
...
@@ -20,7 +20,7 @@ import (
)
// Version is the gost version.
const
Version
=
"2.8.
1
"
const
Version
=
"2.8.
2-dev
"
// Debug is a flag that enables the debug log.
var
Debug
bool
...
...
@@ -76,7 +76,7 @@ var (
DefaultTLSConfig
*
tls
.
Config
// DefaultUserAgent is the default HTTP User-Agent header used by HTTP and websocket.
DefaultUserAgent
=
"Chrome/
60.0.3112.90
"
DefaultUserAgent
=
"Chrome/
78.0.3904.106
"
)
// SetLogger sets a new logger for internal log system.
...
...
ss.go
View file @
1caabf84
...
...
@@ -525,19 +525,11 @@ func (h *shadowUDPdHandler) transportUDP(sc net.Conn, cc net.PacketConn) error {
// Due to in/out byte length is inconsistent of the shadowsocks.Conn.Write,
// we wrap around it to make io.Copy happy.
type
shadowConn
struct
{
wbuf
bytes
.
Buffer
net
.
Conn
}
func
(
c
*
shadowConn
)
Write
(
b
[]
byte
)
(
n
int
,
err
error
)
{
n
=
len
(
b
)
// force byte length consistent
if
c
.
wbuf
.
Len
()
>
0
{
c
.
wbuf
.
Write
(
b
)
// append the data to the cached header
_
,
err
=
c
.
Conn
.
Write
(
c
.
wbuf
.
Bytes
())
c
.
wbuf
.
Reset
()
return
}
_
,
err
=
c
.
Conn
.
Write
(
b
)
return
}
...
...
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