yichya / xray-geodata-cut

Cut unneeded data from geoip.dat or geosite.dat
1 stars 0 forks source link

Little help... #1

Closed alcatraz-zz closed 1 day ago

alcatraz-zz commented 1 year ago

Hey fellas

I downloaded the latest geosite.dat that's around 5000kB and put it in the xray-geodata-cut git clone folder.

I installed golang and ran go run . -in geosite.dat -type geosite -keep "cn,private,geolocation-!cn" go run . -in geosite.dat -type geosite -keep cn,private,geolocation-!cn But for both I get -bash: !cn: event not found

What am I missing? Thx

yichya commented 1 year ago

In bash use ' instead of " for quoting strings with special characters.

alcatraz-zz commented 1 year ago

go run . -in geosite.dat -type geosite -keep "cn,private,geolocation-!cn"

Great. That was it. It downloaded a few dependencies successfully. (I just list them here for reference)

go: downloading google.golang.org/protobuf v1.28.0 go: downloading github.com/xtls/xray-core v1.5.7 go: downloading go.starlark.net v0.0.0-20220328144851-d1966c6b9fcd go: downloading golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a go: downloading github.com/golang/protobuf v1.5.2 go: downloading github.com/pires/go-proxyproto v0.6.2

However, there's another problem.

root@debian:~/xray-geodata-cut/xray-geodata-cut# go run . -in /root/geosite.dat -type geosite -keep 'cn,private,geolocation-!cn' # github.com/xtls/xray-core/common /root/go/pkg/mod/github.com/xtls/xray-core@v1.5.7/common/common.go:69:19: undefined: os.ReadFile /root/go/pkg/mod/github.com/xtls/xray-core@v1.5.7/common/common.go:131:23: undefined: os.ReadFile note: module requires Go 1.18 I wonder if something about the input file geosite.dat has changed since xray 1.5.7 that's being used here? Or should I try an older version of Golang?

Seems like xray can't find the file, even though I specified the full path. Hmm. Should I put geosite.dat in the xray folder somewhere?

yichya commented 1 year ago

Which version of go are you using?

(run go version and paste output here)

alcatraz-zz commented 1 year ago

root@debian:~# go version go version go1.15.15 linux/amd64

Hmm. I used apt to install golang. Is this super old or what?

yichya commented 1 year ago

root@debian:~# go version go version go1.15.15 linux/amd64

Hmm. I used apt to install golang. Is this super old or what?

Yes, very old...

alcatraz-zz commented 1 year ago

I had no idea golang wasn't officially provided by debian anymore. Interesting. Thanks!

yichya commented 1 year ago

I had no idea golang wasn't officially provided by debian anymore. Interesting. Thanks!

Maybe you're just running a super old version of Debian?

wattic commented 1 week ago

running into a similar problem, typed "go run . -in geosite.dat -type geosite -keep 'docker' -out aa.dat " and nothing happened. No error, but no output file either.

yichya commented 1 week ago

running into a similar problem, typed "go run . -in geosite.dat -type geosite -keep 'docker' -out aa.dat " and nothing happened. No error, but no output file either.

Try #3

wattic commented 1 day ago

running into a similar problem, typed "go run . -in geosite.dat -type geosite -keep 'docker' -out aa.dat " and nothing happened. No error, but no output file either.

Try #3

fixed, many thx.