Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: geodata reader for multi-platform compatibility #964

Merged
merged 4 commits into from
May 3, 2021

Conversation

rurirei
Copy link
Contributor

@rurirei rurirei commented May 3, 2021

this provides a method to oveeride fileReader for specified platform, such as gomobile for android. @Loyalsoldier @xiaokangwang

vfilesystem.NewFileSeeker = func(path string) (io.ReadSeekCloser, error) {
	_, name := filepath.Split(path)
	return gomobileasset.Open(name)
}

@rurirei
Copy link
Contributor Author

rurirei commented May 3, 2021

@yuhan6665 may helped for your.

@@ -30,7 +30,7 @@ var (
errCodeNotFound = errors.New("code not found")
)

func emitBytes(f *os.File, code string) ([]byte, error) {
func emitBytes(f io.ReadSeekCloser, code string) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实可以改成 io.ReadSeeker,这样的话,就算是 buffer 或者 []byte 作为实参也可以直接读取并解码。

@rurirei
Copy link
Contributor Author

rurirei commented May 3, 2021

the new geodata loader may causes a slow or failed start with core.NewInstance.Start(), i need to try much times (to tap button) to start service. 😕

@Loyalsoldier
Copy link
Contributor

the new geodata loader may causes a slow or failed start with core.NewInstance.Start(), i need to try much times (to tap button) to start service. 😕

Refinements are on the way.

@Loyalsoldier Loyalsoldier merged commit 238b87d into v2fly:master May 3, 2021
@rurirei rurirei deleted the fix_georeader branch May 4, 2021 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants