| package com.pt5.pthouduan.entity; |
| import com.pt5.pthouduan.service.PasskeyValidator; |
| import com.pt5.pthouduan.service.UserService; |
| import com.turn.ttorrent.tracker.Tracker; |
| import com.turn.ttorrent.tracker.TorrentsRepository; |
| import com.turn.ttorrent.tracker.TrackerRequestProcessor; |
| import org.springframework.beans.factory.annotation.Autowired; |
| import org.springframework.stereotype.Service; |
| import java.io.IOException; |
| public class TrackerInitializer { |
| private PasskeyValidator passkeyValidator; |
| public Tracker createTracker() throws IOException { |
| TorrentsRepository repository = new TorrentsRepository(1000); |
| TrackerRequestProcessor processor = new PasskeyTrackerProcessor( |
| Tracker tracker = new Tracker( |
| "http://127.0.0.1/announce", // 对外公告地址 |
| processor, // 自定义的Processor |
| tracker.setAnnounceInterval(100); |
| tracker.setAcceptForeignTorrents(false); // 禁止未注册的种子 |