接口 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) Returnfalse
by default.
We recommend you not to override the download logic.default Path
frpcDirPathOverride
(Path frpcStorageDirPath) Returnnull
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
getIcon()
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) Returnnull
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) Returnnull
by default.
Get the node selection screen of your frp service.default String
Get the web panel urlReturnnull
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
init()
Initialize your Frpc Impldefault boolean
Returnfalse
by default.default boolean
Returntrue
by default.boolean
isOutdated
(@Nullable Path frpcExecutableFilePath) Get whether there is a frpc update.default void
logOut()
Log out user's account.name()
Get the unique name of your frpc implementation.default void
stopFrpcProcess
(@Nullable Process frpcProcess) Stop the frpc process.
-
方法详细资料
-
downloadFrpc
Returnfalse
by default.
We recommend you not to override the download logic. OpenLink will automatically download frpc file and extract(if you returntrue
in the methodisArchive()
).
If you really want to override the download logic, implement this method and returntrue
.
If you just want to do something before the frpc downloading, implement this method and returnfalse
- 参数:
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 tofrpcDownloadDir
and make sure there is a frpc executable file if you do not implementfrpcDirPathOverride(Path)
(OpenLink will scan the directory to find an executable file).
-
frpcDirPathOverride
Returnnull
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()Returnfalse
by default.- 返回:
- whether the frpc file is an archive.
-
getUpdateFileUrls
Returnnull
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
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
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(maybenull
or blank).- 返回:
- the frpc process.
- 抛出:
Exception
- All exceptions that can throw when creating frpc process.
-
createProxy
Create the remote proxy(tunnel).- 参数:
localPort
- the lan server port.remotePort
- the remote port user decided to use(maybenull
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
Get the frpc version.- 参数:
frpcExecutableFilePath
- the path of the frpc executable file.- 返回:
- the version string of the frpc.
-
stopFrpcProcess
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) Returnnull
by default.
Get the node selection screen of your frp service.- 参数:
lastScreen
- the parent screen(can benull
).- 返回:
- 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) Returnnull
by default.
Get the login screen of your frp service.- 参数:
lastScreen
- the parent screen(can benull
).- 返回:
- 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()Returntrue
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
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.
-