Counter-rotating agency plant and method
Technical field
Agency plant and method the present invention relates to reverse.
Background technology
Acting server is to replace the user to send request to source data server, and gives subscriber's main station the result that source data server is returned.If but acting server also in Intranet, external user just can not be connected to the acting server of Intranet.
Summary of the invention
The purpose of this invention is to provide a kind of counter-rotating agency plant and method, to solve acting server in Intranet, external user can not be connected to the acting server of Intranet, visit Intranet problem of resource.
For realizing above-mentioned purpose, counter-rotating agency plant of the present invention comprises:
The Internet main frame is connected in the Internet net, is used for sending the mailbox of the mail of specified format to the acting server appointment through mail server; In be provided with Client Agent, be used to be provided with address and the port numbers of monitoring link, be arranged on email address, the username and password of registration mailbox in the acting server;
Acting server is used for scan mail and extracts the Internet host IP address and the port numbers of sending mail, is used to set up the communication channel between Internet main frame and the Resource Server;
Mail server is used for the transmission of Internet main frame to the acting server mail;
Resource Server is used for storage resources information, and the access request of response agent server;
The Intranet that the interconnection of said Resource Server and acting server constitutes, acting server also respectively with outer net in Internet main frame and mail server network interconnection.
Counter-rotating Proxy Method of the present invention may further comprise the steps:
(1) in client Internet main frame, starts Client Agent, address and port numbers that Client Agent is monitored link are set, be arranged on email address, the username and password of registration mailbox in the acting server; Mailbox through registration sends the mailbox of the mail of specified format to the acting server appointment;
(2) acting server starts and scan mail; Whether check has the mail that registered appointment mailbox sends in the comfortable system in the mail; And checking whether land order correct, if correct, then from mail, extract the Internet host IP address and the port numbers of sending mail;
(3) acting server sends connection request through IP address and the port numbers extracted to the Internet of client main frame, and Client Agent is then agreed to connect if listen to connection request; Client browser is set to through the local client proxy access;
(4) client browser sends the request of browsing the Intranet Resource Server to Client Agent, and Client Agent receives and sends to acting server to request through interface channel; Acting server is according to client-requested access resources server; And feed back to Client Agent to the response of Resource Server through interface channel; Client Agent is given browser responsive feedback again, realizes the visit of client Internet main frame to the Intranet Resource Server.
Further, the mail of specified format is meant and comprises annex in the mail in the said step (1), and this annex is a text, and form does<b ><IP>Address</IP><Port>PORT</port>,</b>Wherein: address is the address of external host, and PORT is the port numbers that external host receives link.
Further, said step at first starts acting server in (2), and the acting server scan mail is checked the mail that whether has registered appointment mailbox in the comfortable system in the mail; If do not exist, wait for a period of time and continue scanning; If exist, check whether the subject territory of this mail header is to land order; If it is correct to land order, extract IP address and port numbers in the Email attachment.
Further, the subject territory of said mail header is landed order and is done
LOGIN<Space>Username<Space>Password,Wherein:<space>The expression space; Username representes user name; Password representes password.
Counter-rotating agency plant of the present invention and method connect the outer net main frame with acting server as client, thereby set up an interface channel, and the outer net main frame is realized the visit to the Intranet resource through this passage, and can not influence the setting of fire compartment wall.
Description of drawings
Fig. 1 is a counter-rotating acting server fundamental diagram of the present invention.
Embodiment
As shown in Figure 1, the counter-rotating agency plant comprises:
The Internet main frame is connected in the Internet net, is used for sending the mailbox of the mail of specified format to the acting server appointment through mail server; In be provided with Client Agent, be used to be provided with address and the port numbers of monitoring link, be arranged on email address, the username and password of registration mailbox in the acting server;
Acting server is used for scan mail and extracts the Internet host IP address and the port numbers of sending mail, is used to set up the communication channel between Internet main frame and the Resource Server;
Mail server is used for the transmission of Internet main frame to the acting server mail;
Resource Server is used for storage resources information, and the access request of response agent server;
The Intranet that the interconnection of above-mentioned Resource Server and acting server constitutes, acting server also respectively with outer net in Internet main frame and mail server network interconnection.
The concrete steps of counter-rotating Proxy Method are following:
[1] at first open acting server, acting server uses the POP agreement, logs on predefined public network mailbox, downloads online mail, and deletes this mail.Check the sender of mail, if the Email Sender is the good Email Sender of predefine, the Email Sender is correct; Checking mail matter topics, if theme is LOGIN user password, just extract user and password verifies, if checking is correct, is exactly this user's correct verification mail.If an item mistake is arranged, authentication failed.Used the double verification mode to prove user's correctness.
[2] after user rs authentication was accomplished, acting server extracted the IP address and the port numbers of main frame from annex.If extraction mistake; Server is not done any action; Otherwise initiate a thread,, just set up the passage of an acting server and Internet main frame if this thread is connected the successful connection of Internet main frame according to the IP address in the annex with port numbers; The Intenate main frame is just analyzed these requests the acting server acting server is issued in the request of Intranet resource through this passage, and visits the Intranet Resource Server on request.The Intranet Resource Server to acting server request reply, and acting server is returned to the Internet main frame to response result.
[3] connect retry.Break off if connect, acting server retry again connects if get nowhere several times continuously will and break off several times.
[4] Client Agent.Have an agency in client, the user can be provided with the address and the port numbers of agents listen.When Client Agent started, it was monitored on remote address that the user is provided with and port; It passes through to send smtp protocol to the theme of user's user name password composition LOGIN user password form to port of monitoring and IP address, be transmitted to acting server by the mailbox of on acting server, registering and monitor mailbox, and continuation is monitored.Do not resend again if also connect to arrive, cancel connection up to the user.If listen to connection, just agree to connect, to notify the user successful connection, and open local listen address 127.0.0.1 and port, this port can be provided with by user oneself.Client Agent remote address and port are to be used for the connection request of snoop agents server, and local address and port are the requests that is used for monitoring browser.
[5] user is provided with cost machine: 127.0.0.1 to own browser agent server address, and port is set to the local agent port.In address field, import the interior net address of to visit then; Browser just sends request to Client Agent; Client Agent request through it and being connected of Intranet acting server, a acting server to Intranet, the Intranet acting server is according to the requirement request Intranet resource of browser.The Intranet agency service is returned to Client Agent to the result through connection, and Client Agent returns the result to browser.
The present invention only needs on Intranet and Internet main frame, to install the Intranet acting server respectively and local agent need be to the configuration of other main frames.The Intranet acting server initiatively connects the Internet main frame, can the passing through NAT agency.The Internet main frame makes system have certain flexibility through the IP address and the port numbers of mail box notice Internet main frame.