接口 Frpc


public interface Frpc
Frpc interface.
  • 方法概要

    修饰符和类型
    方法
    说明
    createFrpcProcess(Path frpcExecutableFilePath, int localPort, @Nullable String remotePort)
    Create the frpc process.
    createProxy(int localPort, @Nullable String remotePort)
    Create the remote proxy(tunnel).
    default boolean
    downloadFrpc(Path frpcDownloadDir)
    Return false by default.
    We recommend you not to override the download logic.
    default Path
    frpcDirPathOverride(Path frpcStorageDirPath)
    Return null by default.
    You can override this method to use another frpc executable file.
    getFrpcVersion(Path frpcExecutableFilePath)
    Get the frpc version.
    default net.minecraft.resources.ResourceLocation
    Get the ResourceLocation(or Identifier) of the icon of your frp service.
    default net.minecraft.client.gui.screens.Screen
    getLoginScreen(@Nullable net.minecraft.client.gui.screens.Screen lastScreen)
    Return null by default.
    Get the login screen of your frp service.
    default net.minecraft.client.gui.screens.Screen
    getNodeSelectionScreen(@Nullable net.minecraft.client.gui.screens.Screen lastScreen)
    Return null by default.
    Get the node selection screen of your frp service.
    default String
    Get the web panel url
    default List<String>
    Return null by default.
    Get the url list of the frpc file if there is an update.
    id()
    Get the unique id of your frpc implementation.
    default void
    Initialize your Frpc Impl
    default boolean
    Return false by default.
    default boolean
    Return true by default.
    boolean
    isOutdated(@Nullable Path frpcExecutableFilePath)
    Get whether there is a frpc update.
    default void
    Log out user's account.
    Get the unique name of your frpc implementation.
    default void
    stopFrpcProcess(@Nullable Process frpcProcess)
    Stop the frpc process.
  • 方法详细资料

    • downloadFrpc

      default boolean downloadFrpc(Path frpcDownloadDir)
      Return false by default.
      We recommend you not to override the download logic. OpenLink will automatically download frpc file and extract(if you return true in the method isArchive()).
      If you really want to override the download logic, implement this method and return true.
      If you just want to do something before the frpc downloading, implement this method and return false
      参数:
      frpcDownloadDir - the download directory of the frpc executable file.
      返回:
      whether this method override frpc downloading.
      Implementation Note:
      If you return true in this method, you have to download frpc to frpcDownloadDir and make sure there is a frpc executable file if you do not implement frpcDirPathOverride(Path)(OpenLink will scan the directory to find an executable file).
    • frpcDirPathOverride

      default Path frpcDirPathOverride(Path frpcStorageDirPath)
      Return null by default.
      You can override this method to use another frpc executable file.
      参数:
      frpcStorageDirPath - the old path of the frpc storage directory.
      返回:
      the new path of the frpc storage directory.
    • isArchive

      default boolean isArchive()
      Return false by default.
      返回:
      whether the frpc file is an archive.
    • getUpdateFileUrls

      default List<String> getUpdateFileUrls()
      Return null by default.
      Get the url list of the frpc file if there is an update. The order in the list determines the url's priority.
      返回:
      the full url(with http:// or https://) list of the new frpc file. The higher the position of the url in the list, the higher the priority. If there is not an update, return null.
    • init

      default void init() throws Exception
      Initialize your Frpc Impl
      抛出:
      Exception - All exceptions that can throw when initiating.
    • id

      String id()
      Get the unique id of your frpc implementation.
      返回:
      your id.
    • name

      String name()
      Get the unique name of your frpc implementation.
      返回:
      your name.
    • isOutdated

      boolean isOutdated(@Nullable @Nullable Path frpcExecutableFilePath)
      Get whether there is a frpc update.
      参数:
      frpcExecutableFilePath - the path of the frpc executable file.
      返回:
      whether there is a frpc update.
    • createFrpcProcess

      Process createFrpcProcess(Path frpcExecutableFilePath, int localPort, @Nullable @Nullable String remotePort) throws Exception
      Create the frpc process.
      参数:
      frpcExecutableFilePath - the path of the frpc executable file.
      localPort - the lan server port.
      remotePort - the remote port user decided to use(maybe null or blank).
      返回:
      the frpc process.
      抛出:
      Exception - All exceptions that can throw when creating frpc process.
    • createProxy

      String createProxy(int localPort, @Nullable @Nullable String remotePort) throws Exception
      Create the remote proxy(tunnel).
      参数:
      localPort - the lan server port.
      remotePort - the remote port user decided to use(maybe null or blank).
      返回:
      the remote ip of the remote proxy for players to join.
      抛出:
      Exception - All exceptions that can throw when creating proxy.
      Implementation Note:
      You can ignore remotePort when you cannot use that port to create the remote proxy. You should only create the frpc tunnel in this method. DO NOT START FRPC IN THIS METHOD!
    • getFrpcVersion

      String getFrpcVersion(Path frpcExecutableFilePath)
      Get the frpc version.
      参数:
      frpcExecutableFilePath - the path of the frpc executable file.
      返回:
      the version string of the frpc.
    • stopFrpcProcess

      default void stopFrpcProcess(@Nullable @Nullable Process frpcProcess)
      Stop the frpc process.
      参数:
      frpcProcess - the process of the frpc executable file.
    • getNodeSelectionScreen

      default net.minecraft.client.gui.screens.Screen getNodeSelectionScreen(@Nullable @Nullable net.minecraft.client.gui.screens.Screen lastScreen)
      Return null by default.
      Get the node selection screen of your frp service.
      参数:
      lastScreen - the parent screen(can be null).
      返回:
      the screen instance of the node selection screen.
      Implementation Note:
      If there is not any node selection screen, do not implement this method.
    • getLoginScreen

      default net.minecraft.client.gui.screens.Screen getLoginScreen(@Nullable @Nullable net.minecraft.client.gui.screens.Screen lastScreen)
      Return null by default.
      Get the login screen of your frp service.
      参数:
      lastScreen - the parent screen(can be null).
      返回:
      the screen instance of the login screen.
      Implementation Note:
      If your frp service do not have to log in, do not implement this method.
    • getIcon

      default net.minecraft.resources.ResourceLocation getIcon()
      Get the ResourceLocation(or Identifier) of the icon of your frp service.
      返回:
      the ResourceLocation(or Identifier) of the icon of your frp service.
      Implementation Note:
      If there is not any icon, do not implement this method.
    • isLoggedIn

      default boolean isLoggedIn()
      Return true by default.
      返回:
      whether user is logged into your frp service.
      Implementation Note:
      If your frp service do not have to log in, do not implement this method.
    • logOut

      default void logOut()
      Log out user's account.
      Implementation Note:
      If your frp service do not have to log out, do not implement this method.
    • getPanelUrl

      default String getPanelUrl()
      Get the web panel url
      返回:
      the url of your frp service web panel
      Implementation Note:
      If your frp service do not have a web panel, do not implement this method.