mirror of
https://github.com/whyvl/wireproxy.git
synced 2025-04-29 19:01:42 +02:00
fix: improvements in memory consumption (#100)
* fix: must close the connection after processing I think it should help to close #80 * feat: migration to github.com/things-go/go-socks5 - preallocate config slices - not used interfaces in consumer - do not allocate new variables in loops * feat: close connection after full processing * feat: correct process sigint signal * feat: improve build system * fix: http proxy * feat: update golangci-lint-action to v3.7.0 * feat: correct process routines * fix: close http conn correctly * feat: update golangci-lint-action to v4 * fix: goreleaser used clean now
This commit is contained in:
parent
49f568810c
commit
a2d7aecb6f
12 changed files with 205 additions and 140 deletions
19
config.go
19
config.go
|
@ -36,7 +36,7 @@ type TCPClientTunnelConfig struct {
|
|||
}
|
||||
|
||||
type STDIOTunnelConfig struct {
|
||||
Target string
|
||||
Target string
|
||||
}
|
||||
|
||||
type TCPServerTunnelConfig struct {
|
||||
|
@ -125,8 +125,9 @@ func parseNetIP(section *ini.Section, keyName string) ([]netip.Addr, error) {
|
|||
return []netip.Addr{}, nil
|
||||
}
|
||||
|
||||
var ips []netip.Addr
|
||||
for _, str := range key.StringsWithShadows(",") {
|
||||
keys := key.StringsWithShadows(",")
|
||||
var ips = make([]netip.Addr, 0, len(keys))
|
||||
for _, str := range keys {
|
||||
str = strings.TrimSpace(str)
|
||||
ip, err := netip.ParseAddr(str)
|
||||
if err != nil {
|
||||
|
@ -143,8 +144,9 @@ func parseCIDRNetIP(section *ini.Section, keyName string) ([]netip.Addr, error)
|
|||
return []netip.Addr{}, nil
|
||||
}
|
||||
|
||||
var ips []netip.Addr
|
||||
for _, str := range key.StringsWithShadows(",") {
|
||||
keys := key.StringsWithShadows(",")
|
||||
var ips = make([]netip.Addr, 0, len(keys))
|
||||
for _, str := range keys {
|
||||
prefix, err := netip.ParsePrefix(str)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -162,8 +164,9 @@ func parseAllowedIPs(section *ini.Section) ([]netip.Prefix, error) {
|
|||
return []netip.Prefix{}, nil
|
||||
}
|
||||
|
||||
var ips []netip.Prefix
|
||||
for _, str := range key.StringsWithShadows(",") {
|
||||
keys := key.StringsWithShadows(",")
|
||||
var ips = make([]netip.Prefix, 0, len(keys))
|
||||
for _, str := range keys {
|
||||
prefix, err := netip.ParsePrefix(str)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -237,7 +240,7 @@ func ParseInterface(cfg *ini.File, device *DeviceConfig) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ParsePeer parses the [Peer] section and extract the information into `peers`
|
||||
// ParsePeers parses the [Peer] section and extract the information into `peers`
|
||||
func ParsePeers(cfg *ini.File, peers *[]PeerConfig) error {
|
||||
sections, err := cfg.SectionsByName("Peer")
|
||||
if len(sections) < 1 || err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue