Set up a SOCKS proxy in your GeckoView
saadullah216 opened this issue · 5 comments
i am trying to setup proxy with GeckoView in my android app but it is not working.
Actually i want to use tor with GeckoView.
i am using following code:
val builder = GeckoRuntimeSettings.Builder()
val args = arrayOf("socks://127.0.0.1:9150")
//val args = arrayOf("--proxy-server=socks://127.0.0.1:9150")
builder.arguments(args)
val settings = builder.build()
val runtime = GeckoRuntime.create(applicationContext , settings)
geckoSession.open(runtime)
We don't provide any API to set proxy. But you can set up it like Firefox desktop (about:config's preferences), so I guess that you may set up it via YAML files (see https://firefox-source-docs.mozilla.org/mobile/android/geckoview/consumer/automation.html#enabling-reading-configuration-from-a-file-unconditionally)
hey what about authentication, can we provide username and password somehow too?
And can you also give you more info about DNS resolution?
We don't provide any API to set proxy. But you can set up it like Firefox desktop (about:config's preferences), so I guess that you may set up it via YAML files (see https://firefox-source-docs.mozilla.org/mobile/android/geckoview/consumer/automation.html#enabling-reading-configuration-from-a-file-unconditionally)
what values we can write in yaml file?
can i put media.peerconnection.enabled=false
?
i was declare yaml file
# Contents of /data/local/tmp/com.yourcompany.yourapp-geckoview-config.yaml
env:
MOZ_LOG: nsHttp:5
args:
- --marionette
# - --profile
# - "/path/to/gecko-profile"
prefs:
media.peerconnection.enabled.boolean: false
media.peerconnection.enabled: false
foo.bar.string: "string"
foo.bar.int: 500
then when i access about:config
, the property media.peerconnection.enabled
value still true
my code
val browser = browser = findViewById<GeckoView>(R.id.geckoview)
val session = GeckoSession(settings.build())
// Workaround for Bug 1758212
session.contentDelegate = object : ContentDelegate {}
// runtime = GeckoRuntime.create(this)
var builder = GeckoRuntimeSettings.Builder()
if (BuildConfig.DEBUG) {
builder.remoteDebuggingEnabled(true)
builder.consoleOutput(true)
}
// builder.preferences().setBoolean("media.peerconnection.enabled", false)
// enable about:config
builder.aboutConfigEnabled(true)
// modify about:config
val path = Uri.parse("file:///android_asset/gecko-config.yaml")
val geckoConfigPath = path.toString()
// Timber.tag("gecko: config").d(geckoConfigPath)
builder.configFilePath(geckoConfigPath)
runtime = GeckoRuntime.create(this, builder.build())
session.open(runtime)
browser.setSession(session)
// session.loadUri("about:buildconfig")
session.loadUri("about:config")
Was just checking if the username-password support is added somehow. then I noticed my comment above...
It seems not.
Here is another interesting issue tho:
https://bugzilla.mozilla.org/show_bug.cgi?id=122752