Rurilib.Proxies

           var settings = new ProxySettings();
            var proxyClient = new NoProxyClient(settings);

            // Create the custom proxied client
            using var client = new RLHttpClient(proxyClient);

I want to confirm the above code is used if we don’t want to use any proxy. If yes, then isn’t there any more straightforward method available like

request.proxies = nothing;

Or anything similar to this? If not, can you explain the above code a little bit for me?

Currently there is no better way, although in the last commit I added a way to skip the first line and directly declare var proxyClient = new NoProxyClient();

Maybe I could automatically declare to use a NoProxyClient when doing new RLHttpClient(), it’s a nice idea. Please open an issue on github and I will implement this as well and publish a new package.

1 Like

Ok I’ll do it right way

@Ruri how to use different type of proxies like HTTP, Socks or auth using this package
can you explain in detail with example would be better

There is already an example of this on the repo

1 Like
Host = "127.0.0.1",
                Port = 8888,

the file contains like host:port so I’ll have to split the host and port then assign the value respectively?

Yes exactly, there are no helpers for it yet.

 using var tcpClient = await httpProxyClient.ConnectAsync("example.com", 80);

            // Now you can send messages on the raw TCP socket
            using var netStream = tcpClient.GetStream();
            using var memory = new MemoryStream();

            // Send HELLO
            var requestBytes = Encoding.ASCII.GetBytes("HELLO");
            await netStream.WriteAsync(requestBytes.AsMemory(0, requestBytes.Length));

            // Read the response
            await netStream.CopyToAsync(memory);
            memory.Position = 0;

is this piece of code is necessary if yes can you elaborate a little bit for me

This is necessary only if you’re not using RuriLib.Http but want to make HTTP requests directly using a TCP client, it’s just an example. Those proxies can be used with many protocols as long as they are on top of TCP.

I suggest you look directly into RuriLib.Http and see the documentation of RuriLib.Proxies just for creating the proxy client, then pass it to the http client and forget about using it directly.

1 Like

How to use proxy in Parallelizer? Can I also pass proxy in function like the credential list?

It would be better to make a proxy pool and then take proxies from the pool directly inside the work function, see the RuriLib library code for an example

1 Like

Is pool is kind of queue data structure?

Sort of, yes. But it’s not implemented via a linked list, it’s just a normal list (so it’s a bit slower but allows for easier manipulation of the elements in my opinion).

Thanks, will you add this feature in upcoming updates for RuriLib.Parallelization to handle proxies automatically as it does with combo list.

I don’t think I will add it to RuriLib.Parallelization, if anything I would add it to RuriLib.Proxies.

1 Like

@Ruri thanks for the solution of reattaching ViewModel it solves my problem. I want to ask few things if you have time

  1. I have my proxylist which contains the host, port, proxy type, username, and password if exists how can I use it in RuriLib.Parallelization? Will parallezier automatically select the proxy from list or do I have to implement a mechanism?
  2. How does OB detect whether a proxy is alive, bad, or ban while a runner is running?

You have to implement a mechanism to take a proxy from the list. I suggest looking at my ProxyPool implementation inside RuriLib you can straight up copy it. Just look at the code. All bots know about the proxy pool (it’s like a shared object) and can take proxies from it. The proxy pool will handle the logic to select which proxies can be given out basing on the proxy state. If a bot wants to ban a proxy it will just set its state to banned and the proxy pool will know it. When proxies are given out they are set to busy (unless concurrent mode is active) so it will not give out the same proxy to two bots. When the bot ends the run, the proxy is set to available once again so it can be taken by another bot.

1 Like

In OB ban or bad satus of proxies is depend upon bot.Status but in RuriLib.Parallelization i can check the status of bot in OnResult() so the question is there is a way to go back from OnResult() to the paralleizer so that I can retry the bot

You should loop directly in the work function of the parallelizer, only exit (and hence produce a result) when you have a final status (e.g. fail or success). Look at the work function of OB2, there is a loop that will run until there’s a good proxy which doesn’t end up in BAN/ERROR.

@Ruri In OB2 source I want to change this constructor

 public ProxyPool(IEnumerable<ProxySource> sources, ProxyPoolOptions options = null)
        {
            this.sources = sources.ToList();
            this.options = options ?? new ProxyPoolOptions();
        }

In my case I only have one option, for now, that is to load proxies from the list how can I change it that instead of ProxySource, it should accept a list of proxies and that proxies should be set

public IEnumerable<Proxy> Proxies => proxies;
        private List<Proxy> proxies = new();

in one of these, I don’t know why there are two proxies if you also explain the purpose of both that would be great.
So basically I want to create the object of proxypool with the loaded proxies from the file only, no other source are necessary.