From f0496f8184446c444a1e6e299f8a09cb478158a4 Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Mon, 3 Apr 2023 06:15:45 +0400 Subject: [PATCH 1/9] ran `go mod tidy` right after cloning --- go.mod | 3 --- go.sum | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/go.mod b/go.mod index 2415595..eefaf53 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ require ( github.com/gin-gonic/gin v1.6.3 github.com/go-git/go-git/v5 v5.4.2 github.com/google/uuid v1.3.0 - github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e github.com/lithammer/shortuuid v3.0.0+incompatible github.com/moby/sys/mount v0.2.0 // indirect github.com/moby/term v0.0.0-20201110203204-bea5bbe245bf // indirect @@ -20,11 +19,9 @@ require ( github.com/otiai10/copy v1.6.0 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/shirou/gopsutil/v3 v3.22.10 - github.com/spf13/viper v1.7.0 github.com/urfave/cli/v2 v2.3.0 gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 // indirect gitlab.com/NebulousLabs/go-upnp v0.0.0-20181011194642-3a71999ed0d3 - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 gopkg.in/yaml.v2 v2.4.0 gotest.tools/v3 v3.0.3 // indirect ) diff --git a/go.sum b/go.sum index cd60a61..89a3c7f 100644 --- a/go.sum +++ b/go.sum @@ -65,7 +65,6 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= @@ -285,7 +284,6 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjr github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= @@ -451,8 +449,6 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e h1:XmA6L9IPRdUr28a+SK/oMchGgQy159wvzXA5tJ7l+40= -github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e/go.mod h1:AFIo+02s+12CEg8Gzz9kzhCbmbq6JcKNrhHffCGA9z4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= @@ -486,7 +482,6 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= @@ -558,7 +553,6 @@ github.com/lithammer/shortuuid v3.0.0+incompatible/go.mod h1:FR74pbAuElzOUuenUHT github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -589,7 +583,6 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= @@ -674,7 +667,6 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc= @@ -770,24 +762,19 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -807,7 +794,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -941,7 +927,6 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= From fbbb23c13aaf58ac7a3fbbfa6a329f561d252284 Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Mon, 3 Apr 2023 06:15:56 +0400 Subject: [PATCH 2/9] dead code --- cmd/action.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmd/action.go b/cmd/action.go index 559258b..5564249 100644 --- a/cmd/action.go +++ b/cmd/action.go @@ -17,10 +17,6 @@ var CliAction = func(ctx *cli.Context) error { if err != nil { fmt.Print(err) } - - for { - - } //server.Rpc() } From 53bef115b09d179f7ea2c54ebd7f8fef95587d48 Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Mon, 3 Apr 2023 06:16:29 +0400 Subject: [PATCH 3/9] fix cyclic dependancy + duplicate test --- config/{ => generate}/config_test.go | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) rename config/{ => generate}/config_test.go (61%) diff --git a/config/config_test.go b/config/generate/config_test.go similarity index 61% rename from config/config_test.go rename to config/generate/config_test.go index f8dfd2c..e3a0408 100644 --- a/config/config_test.go +++ b/config/generate/config_test.go @@ -1,28 +1,28 @@ -package config +package generate import ( "fmt" - "github.com/Akilan1999/p2p-rendering-computation/config/generate" + "github.com/Akilan1999/p2p-rendering-computation/config" "os" "testing" ) -func TestConfigInit(t *testing.T) { - _, err := ConfigInit(nil) - if err != nil { - t.Error(err) - } -} +// func TestConfigInit(t *testing.T) { +// _, err := config.ConfigInit(nil) +// if err != nil { +// t.Error(err) +// } +// } -func TestSetDefaults(t *testing.T) { - _, err := generate.SetDefaults("", false) - if err != nil { - t.Error(err) - } -} +// func TestSetDefaults(t *testing.T) { +// _, err := SetDefaults("", false) +// if err != nil { +// t.Error(err) +// } +// } func TestGetCurrentPath(t *testing.T) { - path, err := generate.GetCurrentPath() + path, err := GetCurrentPath() if err != nil { fmt.Println(err) t.Error(err) @@ -31,7 +31,7 @@ func TestGetCurrentPath(t *testing.T) { } func TestGetPathP2PRC(t *testing.T) { - path, err := GetPathP2PRC("") + path, err := config.GetPathP2PRC("") if err != nil { fmt.Println(err) t.Error(err) @@ -48,14 +48,14 @@ func TestSetEnvName(t *testing.T) { } // Sets the environment variable as the default to read // for P2PRC - err = SetEnvName("TEST") + err = config.SetEnvName("TEST") if err != nil { fmt.Println(err) t.Error(err) } // Checks if the output for the default read is "lol" - path, err := GetPathP2PRC("") + path, err := config.GetPathP2PRC("") if err != nil { fmt.Println(err) t.Error(err) From 86aaba23c4469bcb8e3648aadbcf174e4b530d89 Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Mon, 3 Apr 2023 06:17:19 +0400 Subject: [PATCH 4/9] hardcoded default path incorrect --- config/generate/generate.go | 3 ++- p2p/ip_table.json | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config/generate/generate.go b/config/generate/generate.go index 6c95792..212f607 100644 --- a/config/generate/generate.go +++ b/config/generate/generate.go @@ -72,7 +72,8 @@ func SetDefaults(envName string, forceDefault bool, CustomConfig interface{}, No if len(ConfigUpdate) == 0 { //Setting default paths for the config file - Defaults.IPTable = defaultPath + "p2p/iptable/ip_table.json" + Defaults.IPTable = defaultPath + "p2p/ip_table.json" + // Defaults.IPTable = defaultPath + "p2p/iptable/ip_table.json" Defaults.DefaultDockerFile = defaultPath + "server/docker/containers/docker-ubuntu-sshd/" Defaults.DockerContainers = defaultPath + "server/docker/containers/" Defaults.SpeedTestFile = defaultPath + "p2p/50.bin" diff --git a/p2p/ip_table.json b/p2p/ip_table.json index d2ea19c..83c3081 100644 --- a/p2p/ip_table.json +++ b/p2p/ip_table.json @@ -4,10 +4,13 @@ "Name": "Node1", "IPV4": "64.227.168.102", "IPV6": "", - "Latency": 0, + "Latency": 145800903, + "Download": 0, + "Upload": 0, "ServerPort": "8088", - "NAT": "False", - "EscapeImplementation": "None" + "NAT": "False", + "EscapeImplementation": "None", + "CustomInformation": null } ] -} +} \ No newline at end of file From cf1e7c6d6f00cad8201f7baa5e41ed264d177bea Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Mon, 3 Apr 2023 21:05:57 +0400 Subject: [PATCH 5/9] wrong container json file paths --- client/grouptrackcontainers.json | 1 + client/trackcontainers.json | 1 + config/generate/generate.go | 4 ++-- main.go | 5 +++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/grouptrackcontainers.json b/client/grouptrackcontainers.json index e69de29..9e26dfe 100644 --- a/client/grouptrackcontainers.json +++ b/client/grouptrackcontainers.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/client/trackcontainers.json b/client/trackcontainers.json index e69de29..9e26dfe 100644 --- a/client/trackcontainers.json +++ b/client/trackcontainers.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/config/generate/generate.go b/config/generate/generate.go index 212f607..7ed5581 100644 --- a/config/generate/generate.go +++ b/config/generate/generate.go @@ -79,8 +79,8 @@ func SetDefaults(envName string, forceDefault bool, CustomConfig interface{}, No Defaults.SpeedTestFile = defaultPath + "p2p/50.bin" Defaults.IPV6Address = "" Defaults.PluginPath = defaultPath + "plugin/deploy" - Defaults.TrackContainersPath = defaultPath + "client/trackcontainers/trackcontainers.json" - Defaults.GroupTrackContainersPath = defaultPath + "client/trackcontainers/grouptrackcontainers.json" + Defaults.TrackContainersPath = defaultPath + "client/trackcontainers.json" + Defaults.GroupTrackContainersPath = defaultPath + "client/grouptrackcontainers.json" Defaults.ServerPort = "8088" Defaults.FRPServerPort = "True" Defaults.CustomConfig = CustomConfig diff --git a/main.go b/main.go index 66fda31..aa9542f 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,11 @@ package main import ( - "github.com/Akilan1999/p2p-rendering-computation/cmd" - "github.com/urfave/cli/v2" "log" "os" + + "github.com/Akilan1999/p2p-rendering-computation/cmd" + "github.com/urfave/cli/v2" ) // VERSION specifies the version of the platform From 806b499e72451373facbda5255d0a42ada5ec088 Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Mon, 3 Apr 2023 22:48:57 +0400 Subject: [PATCH 6/9] more explicit --rm instructions + erroring out if no --id provided --- cmd/action.go | 14 +++++++++----- cmd/flags.go | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/action.go b/cmd/action.go index 5564249..d338a19 100644 --- a/cmd/action.go +++ b/cmd/action.go @@ -92,10 +92,14 @@ var CliAction = func(ctx *cli.Context) error { } // Function called to stop and remove server from Docker - if RemoveVM != "" && ID != "" { - err := client.RemoveContianer(RemoveVM, ID) - if err != nil { - fmt.Print(err) + if RemoveVM != "" { + if ID == "" { + fmt.Println("provide container ID via --ID or --id") + } else { + err := client.RemoveContianer(RemoveVM, ID) + if err != nil { + fmt.Print(err) + } } } @@ -178,7 +182,7 @@ var CliAction = func(ctx *cli.Context) error { fmt.Println("Success") } } else { - fmt.Println("provide container ID") + fmt.Println("provide container ID via --ID or --id") } } diff --git a/cmd/flags.go b/cmd/flags.go index 35c8c5a..c2a0a3f 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -92,7 +92,7 @@ var AppConfigFlags = []cli.Flag{ &cli.StringFlag{ Name: "RemoveVM", Aliases: []string{"rm"}, - Usage: "Stop and Remove Docker container", + Usage: "Stop and Remove Docker container (IP:port) accompanied by container ID via --ID or --id", EnvVars: []string{"REMOVE_VM"}, Destination: &RemoveVM, }, From 7984f72db18ba43e0c4f4b86fc232713774c64e0 Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Mon, 3 Apr 2023 22:50:11 +0400 Subject: [PATCH 7/9] better wording --- cmd/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/flags.go b/cmd/flags.go index c2a0a3f..250ad1a 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -148,7 +148,7 @@ var AppConfigFlags = []cli.Flag{ &cli.BoolFlag{ Name: "TrackedContainers", Aliases: []string{"tc"}, - Usage: "View containers which have " + + Usage: "View (currently running) containers which have " + "been created from the client side ", EnvVars: []string{"TRACKED_CONTAINERS"}, Destination: &TrackedContainers, From 0550a35df1562e79ebb9dbe0b533b8ad5c6085d4 Mon Sep 17 00:00:00 2001 From: Farhan Alvi <52133344+farhansolodev@users.noreply.github.com> Date: Mon, 3 Apr 2023 22:55:16 +0400 Subject: [PATCH 8/9] Update ip_table.json --- p2p/ip_table.json | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/p2p/ip_table.json b/p2p/ip_table.json index 83c3081..60a10d4 100644 --- a/p2p/ip_table.json +++ b/p2p/ip_table.json @@ -4,13 +4,10 @@ "Name": "Node1", "IPV4": "64.227.168.102", "IPV6": "", - "Latency": 145800903, - "Download": 0, - "Upload": 0, + "Latency": 0, "ServerPort": "8088", "NAT": "False", - "EscapeImplementation": "None", - "CustomInformation": null + "EscapeImplementation": "None" } ] -} \ No newline at end of file +} From d3181d272e42c14e06ed14dfa2d4d86f73634a38 Mon Sep 17 00:00:00 2001 From: farhansolodev Date: Tue, 4 Apr 2023 00:17:52 +0400 Subject: [PATCH 9/9] revert paths --- config/generate/generate.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/generate/generate.go b/config/generate/generate.go index 7ed5581..6c95792 100644 --- a/config/generate/generate.go +++ b/config/generate/generate.go @@ -72,15 +72,14 @@ func SetDefaults(envName string, forceDefault bool, CustomConfig interface{}, No if len(ConfigUpdate) == 0 { //Setting default paths for the config file - Defaults.IPTable = defaultPath + "p2p/ip_table.json" - // Defaults.IPTable = defaultPath + "p2p/iptable/ip_table.json" + Defaults.IPTable = defaultPath + "p2p/iptable/ip_table.json" Defaults.DefaultDockerFile = defaultPath + "server/docker/containers/docker-ubuntu-sshd/" Defaults.DockerContainers = defaultPath + "server/docker/containers/" Defaults.SpeedTestFile = defaultPath + "p2p/50.bin" Defaults.IPV6Address = "" Defaults.PluginPath = defaultPath + "plugin/deploy" - Defaults.TrackContainersPath = defaultPath + "client/trackcontainers.json" - Defaults.GroupTrackContainersPath = defaultPath + "client/grouptrackcontainers.json" + Defaults.TrackContainersPath = defaultPath + "client/trackcontainers/trackcontainers.json" + Defaults.GroupTrackContainersPath = defaultPath + "client/trackcontainers/grouptrackcontainers.json" Defaults.ServerPort = "8088" Defaults.FRPServerPort = "True" Defaults.CustomConfig = CustomConfig