蘑菇視頻 v1.3.4版本的 MD5 值为:b21956b74446eba74a6fe191899b35cf

以下内容为反编译后的 o0000O00.java 源代码,内容仅作参考


package OoooooO;

import Ooooooo.o000O;
import Ooooooo.o000OOo0;
import Ooooooo.o000Oo00;
import Ooooooo.o000o0o0;
import Ooooooo.o00O0o0o;
import android.content.Context;
import android.net.Uri;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.TrustManager;
import ooOO.OooOo;
import ooOO.Oooo000;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
public class o0000O00 {
    private final o0000O f2110oO0O0Oo0;
    private final Thread f2111oOo0oooO;
    private final Object f2112oo0oOO;
    private final Map<String, o0000oo> f2113oo0oOOO;
    private final ExecutorService f2114oo0oOOO0;
    private final ServerSocket f2115oo0oOOOo;
    private final int f2116oo0oOOo0;
    private final o00000O f2117ooOOOoOo;

    public final class oo0oOOO implements Runnable {
        private final Socket f2119oo0oOOO0;

        public oo0oOOO(Socket socket) {
            this.f2119oo0oOOO0 = socket;
        }

        @Override
        public void run() {
            o0000O00.this.OooO0o(this.f2119oo0oOOO0);
        }
    }

    public static final class oo0oOOO0 {
        private HostnameVerifier f2120oOo0oooO;
        private File f2121oo0oOO;
        private final OooOo f2124oo0oOOOo;
        private TrustManager[] f2126ooOOOoOo;
        private o000o0o0 f2122oo0oOOO = new o00O0o0o(IjkMediaMeta.AV_CH_STEREO_LEFT);
        private o000Oo00 f2123oo0oOOO0 = new o000O();
        private o0OoOo0.oo0oOOO0 f2125oo0oOOo0 = new o0OoOo0.oo0oOO();

        public oo0oOOO0(Context context) {
            this.f2124oo0oOOOo = Oooo000.oo0oOOO0(context);
            this.f2121oo0oOO = o000O00O.oo0oOOO(context);
        }

        private o00000O oo0oOOO0() {
            return new o00000O(this.f2121oo0oOO, this.f2123oo0oOOO0, this.f2122oo0oOOO, this.f2124oo0oOOOo, this.f2125oo0oOOo0, this.f2120oOo0oooO, this.f2126ooOOOoOo);
        }

        public oo0oOOO0 oO0O0Oo(TrustManager[] trustManagerArr) {
            this.f2126ooOOOoOo = trustManagerArr;
            return this;
        }

        public oo0oOOO0 oO0O0Oo0(long j) {
            this.f2122oo0oOOO = new o00O0o0o(j);
            return this;
        }

        public oo0oOOO0 oOo0oooO(HostnameVerifier hostnameVerifier) {
            this.f2120oOo0oooO = hostnameVerifier;
            return this;
        }

        public o0000O00 oo0oOO() {
            return new o0000O00(oo0oOOO0());
        }

        public oo0oOOO0 oo0oOOO(File file) {
            this.f2121oo0oOO = (File) o0000OO0.oo0oOOOo(file);
            return this;
        }

        public oo0oOOO0 oo0oOOOo(o000Oo00 o000oo002) {
            this.f2123oo0oOOO0 = (o000Oo00) o0000OO0.oo0oOOOo(o000oo002);
            return this;
        }

        public oo0oOOO0 oo0oOOo0(o0OoOo0.oo0oOOO0 oo0oooo0) {
            this.f2125oo0oOOo0 = (o0OoOo0.oo0oOOO0) o0000OO0.oo0oOOOo(oo0oooo0);
            return this;
        }

        public oo0oOOO0 ooOOOoOo(int i) {
            this.f2122oo0oOOO = new o000OOo0(i);
            return this;
        }
    }

    private final class oo0oOOOo implements Runnable {
        private final CountDownLatch f2128oo0oOOO0;

        public oo0oOOOo(CountDownLatch countDownLatch) {
            this.f2128oo0oOOO0 = countDownLatch;
        }

        @Override
        public void run() {
            this.f2128oo0oOOO0.countDown();
            o0000O00.this.OooOOO0();
        }
    }

    private boolean OooO0OO() {
        return this.f2110oO0O0Oo0.oo0oOOo0(3, 70);
    }

    public void OooO0o(Socket socket) {
        StringBuilder sb;
        try {
            try {
                o00000OO oo0oOOO2 = o00000OO.oo0oOOO(socket.getInputStream());
                String oo0oOOo02 = o000O0o.oo0oOOo0(oo0oOOO2.f2096oo0oOO);
                if (this.f2110oO0O0Oo0.oo0oOOOo(oo0oOOo02)) {
                    this.f2110oO0O0Oo0.ooOOOoOo(socket);
                } else {
                    oO0O0Oo0(oo0oOOo02).oo0oOOOo(oo0oOOO2, socket);
                }
                OooO0oo(socket);
                sb = new StringBuilder();
            } catch (Throwable th) {
                OooO0oo(socket);
                o0000.oo0oOOOo("Opened connections: " + oO0O0Oo());
                throw th;
            }
        } catch (o000O000 e) {
            e = e;
            OooO0o0(new o000O000("Error processing request", e));
            OooO0oo(socket);
            sb = new StringBuilder();
        } catch (SocketException unused) {
            OooO0oo(socket);
            sb = new StringBuilder();
        } catch (IOException e2) {
            e = e2;
            OooO0o0(new o000O000("Error processing request", e));
            OooO0oo(socket);
            sb = new StringBuilder();
        }
        sb.append("Opened connections: ");
        sb.append(oO0O0Oo());
        o0000.oo0oOOOo(sb.toString());
    }

    private void OooO0o0(Throwable th) {
        o0000.oo0oOOO("HttpProxyCacheServer error", th.getMessage());
    }

    private void OooO0oo(Socket socket) {
        oo0oOOo0(socket);
        oOo0oooO(socket);
        oo0oOOOo(socket);
    }

    private void OooOO0() {
        synchronized (this.f2112oo0oOO) {
            for (o0000oo o0000ooVar : this.f2113oo0oOOO.values()) {
                o0000ooVar.oOo0oooO();
            }
            this.f2113oo0oOOO.clear();
        }
    }

    private void OooOO0O(File file) {
        try {
            this.f2117ooOOOoOo.f2089oo0oOOO.oo0oOO(file);
        } catch (IOException e) {
            o0000.oo0oOOO0("Error touching file " + file, e);
        }
    }

    public void OooOOO0() {
        while (!Thread.currentThread().isInterrupted()) {
            try {
                this.f2114oo0oOOO0.submit(new oo0oOOO(this.f2115oo0oOOOo.accept()));
            } catch (IOException e) {
                OooO0o0(new o000O000("Error during waiting connection", e));
                return;
            }
        }
    }

    private int oO0O0Oo() {
        int i;
        synchronized (this.f2112oo0oOO) {
            i = 0;
            for (o0000oo o0000ooVar : this.f2113oo0oOOO.values()) {
                i += o0000ooVar.oo0oOOO0();
            }
        }
        return i;
    }

    private o0000oo oO0O0Oo0(String str) throws o000O000 {
        o0000oo o0000ooVar;
        synchronized (this.f2112oo0oOO) {
            o0000ooVar = this.f2113oo0oOOO.get(str);
            if (o0000ooVar == null) {
                o0000ooVar = new o0000oo(str, this.f2117ooOOOoOo);
                this.f2113oo0oOOO.put(str, o0000ooVar);
            }
        }
        return o0000ooVar;
    }

    private void oOo0oooO(Socket socket) {
        try {
            if (socket.isOutputShutdown()) {
                return;
            }
            socket.shutdownOutput();
        } catch (IOException e) {
            o0000.ooOOOoOo("Failed to close socket on proxy side: {}. It seems client have already closed connection.", e.getMessage());
        }
    }

    private String oo0oOOO(String str) {
        return String.format(Locale.US, "http://%s:%d/%s", "127.0.0.1", Integer.valueOf(this.f2116oo0oOOo0), o000O0o.oOo0oooO(str));
    }

    private void oo0oOOOo(Socket socket) {
        try {
            if (socket.isClosed()) {
                return;
            }
            socket.close();
        } catch (IOException unused) {
        }
    }

    private void oo0oOOo0(Socket socket) {
        try {
            if (socket.isInputShutdown()) {
                return;
            }
            socket.shutdownInput();
        } catch (SocketException | IOException unused) {
        }
    }

    private File ooOOOoOo(String str) {
        o00000O o00000o = this.f2117ooOOOoOo;
        return new File(o00000o.f2088oo0oOO, o00000o.f2090oo0oOOO0.oo0oOO(str));
    }

    public void OooO() {
        o0000.oo0oOOOo("Shutdown proxy server");
        OooOO0();
        this.f2117ooOOOoOo.f2091oo0oOOOo.release();
        this.f2111oOo0oooO.interrupt();
        try {
            if (this.f2115oo0oOOOo.isClosed()) {
                return;
            }
            this.f2115oo0oOOOo.close();
        } catch (IOException e) {
            OooO0o0(new o000O000("Error shutting down proxy server", e));
        }
    }

    public String OooO00o(String str) {
        return OooO0O0(str, true);
    }

    public String OooO0O0(String str, boolean z) {
        if (!z || !OooO0Oo(str)) {
            return OooO0OO() ? oo0oOOO(str) : str;
        }
        File ooOOOoOo2 = ooOOOoOo(str);
        OooOO0O(ooOOOoOo2);
        return Uri.fromFile(ooOOOoOo2).toString();
    }

    public boolean OooO0Oo(String str) {
        o0000OO0.oo0oOOo0(str, "Url can't be null!");
        return ooOOOoOo(str).exists();
    }

    public void OooO0oO(o00000O0 o00000o02, String str) {
        o0000OO0.oo0oOO(o00000o02, str);
        synchronized (this.f2112oo0oOO) {
            try {
                oO0O0Oo0(str).oo0oOOo0(o00000o02);
            } catch (o000O000 e) {
                o0000.ooOOOoOo("Error registering cache listener", e.getMessage());
            }
        }
    }

    public void OooOO0o(o00000O0 o00000o02) {
        o0000OO0.oo0oOOOo(o00000o02);
        synchronized (this.f2112oo0oOO) {
            for (o0000oo o0000ooVar : this.f2113oo0oOOO.values()) {
                o0000ooVar.oO0O0Oo0(o00000o02);
            }
        }
    }

    private o0000O00(o00000O o00000o) {
        this.f2112oo0oOO = new Object();
        this.f2114oo0oOOO0 = Executors.newFixedThreadPool(8);
        this.f2113oo0oOOO = new ConcurrentHashMap();
        this.f2117ooOOOoOo = (o00000O) o0000OO0.oo0oOOOo(o00000o);
        try {
            ServerSocket serverSocket = new ServerSocket(0, 8, InetAddress.getByName("127.0.0.1"));
            this.f2115oo0oOOOo = serverSocket;
            int localPort = serverSocket.getLocalPort();
            this.f2116oo0oOOo0 = localPort;
            o0000O0O.oo0oOO("127.0.0.1", localPort);
            CountDownLatch countDownLatch = new CountDownLatch(1);
            Thread thread = new Thread(new oo0oOOOo(countDownLatch));
            this.f2111oOo0oooO = thread;
            thread.start();
            countDownLatch.await();
            this.f2110oO0O0Oo0 = new o0000O("127.0.0.1", localPort);
            o0000.oo0oOOOo("Proxy cache server started. Is it alive? " + OooO0OO());
        } catch (IOException | InterruptedException e) {
            this.f2114oo0oOOO0.shutdown();
            throw new IllegalStateException("Error starting local proxy server", e);
        }
    }
}